This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strange diagnostics behavior with patch


On Thu, 2016-01-28 at 21:07 +0100, Thomas Koenig wrote:
> 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?


This looks like a bug in the general error-handling routines: for
diagnostics containing more than one location, the new implementation
of diagnostic_show_locus attempts to show all of the relevant locations
in one loop.  It prints a range of lines covering all of the locations
within the same source file as the primary location of the diagnostic. 

It looks like we need some logic to split things up if there's a big
gap between locations within one diagnostic (and probably to only print
annotation lines under the source if there are some annotations to go
in those lines).

Please can you file this example in bugzilla and CC me?

Thanks
Dave


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]