[Bug fortran/31298] Uninitialized variable in f951 (in read_module)

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Mar 31 21:51:00 GMT 2007



------- Comment #3 from burnus at gcc dot gnu dot org  2007-03-31 22:51 -------
Created an attachment (id=13312)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13312&action=view)
Preliminary patch

> Valgrind gives no error related to uninitialized when compiling with gfortran.

I think you are using:
  valgrind gfortran use_6.f90
this does not work as "gfortran" is only a wrapper program. You need to call
  valgrind /..../4.3.0/f951 use_6.f90 ...
as the problem is in f951.

The error is in the line:
          if (type == INTERFACE_USER_OP)
            new->operator = operator;
of module.c's gfc_match_use as - contrary to my expectation -
gfc_match_generic_spec does not initialize operator for type ==
INTERFACE_USER_OP.

Attached: First draft of a patch, which fixes:
a) Uninitialized variable
b) Better error message for  operator(.foo.) => operator(.gt.)
(use-defined-operator shall not identify a generic-binding, C1111/R1111)
c) Allow  operator(.gt.) => operator(.foo.)

(c) is not working and gives error messages such as:
  Operands of comparison operator '.gt.' at (1) are TYPE(bar)/TYPE(bar)

(Could someone check whether I read C1111/R1111 (in Section 11.2.1 of the
Fortran 2003 standard) correctly that .gt.=>.foo. is allowed and .foo. => .gt.
forbidden? As both g95 and NAG f95 do not seem to support renaming of
operators, I can not even check what other compilers are doing.)


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jvdelisle at gcc dot gnu dot|burnus at gcc dot gnu dot
                   |org                         |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31298



More information about the Gcc-bugs mailing list