Bug 756466 - gfortran functions with result() set cause problems with -finit-local-zero -fno-automatic in tandem
Summary: gfortran functions with result() set cause problems with -finit-local-zero -f...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 15
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-23 17:11 UTC by Karl
Modified: 2011-11-24 10:58 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-24 10:58:38 UTC
Type: ---


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 51292 0 None None None Never

Description Karl 2011-11-23 17:11:25 UTC
Description of problem:
If the compiler flags "-finit-local-zero" and "-fno-automatic" are both used, gfortran will spit out an error like this:
  Error: Function result 'h' at (1) cannot have an initializer
This does not happen if the function does not use the "result" attribute (that is, the result name is the same as the function name).

Version-Release number of selected component (if applicable):
GNU Fortran (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9)

How reproducible:
Always

Steps to Reproduce:
1. Create the following file (call it hello.f90, for example):

program inittest
contains
   function hello (a) result (h)
      integer :: h
      h = 1
   end function hello
end program inittest

2. gfortran -finit-local-zero -fno-automatic hello.f90
 
Actual results:
Error: Function result 'h' at (1) cannot have an initializer

Expected results:
Compiles as usual.

Additional info:
If you change "h" to "hello" and omit the "result (h)" part, it works fine.

Comment 1 Jakub Jelinek 2011-11-24 10:58:38 UTC
Tracking this upstream.


Note You need to log in before you can comment on or make changes to this bug.