Strange diagnostics behavior with patch

Thomas Koenig tkoenig@netcologne.de
Thu Jan 28 20:07:00 GMT 2016


Hello world,

the attached patch fixes the regression of PR 60526 by checking for
the presence of a type with the same name as the variable.  Types
effectively have their separate namespace because the names of their
symtrees start with an uppercase letter.  So far, so good.

However, the error message generated is far to big, and contains
statements which are not relevant and also empty lines.

For the test case

type xx
end type

integer :: q
real :: a
integer, parameter :: h=3

type(xX) :: Xx

end


the error message becomes

type3.f90:8:14:

  type xx
        2
  end type



  integer :: q

  real :: a

  integer, parameter :: h=3



  type(xX) :: Xx
               1
Error: Symbol »xx« at (1) also declared as a type at (2)

The error message is emitted via

       gfc_error ("Symbol %qs at %C also declared as a type at %L", name,
                 &st->n.sym->declared_at);

which I think is the right thing to do.  Am I using this wrong, or is it
a quirk in gfc_error or in the general error handling routines?

Regards

	Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p2.diff
Type: text/x-patch
Size: 1039 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20160128/119455e3/attachment.bin>


More information about the Gcc mailing list