[patch, fortran] Fix PR 44960, accepts invalid reference on function

Tobias Burnus burnus@net-b.de
Sat Jan 18 12:09:00 GMT 2020


On 1/17/20 11:20 PM, Thomas Koenig wrote:

> function_reference_1.f90:9:8:
>
>     9 | print *, foo(1)%a ! { dg-error "Syntax error" }
>       |        1
> Error: Syntax error in expression at (1)

The error message is not helpful at all. I was recently struggling to 
understand why/where some code was failing with syntax error – and it 
took me a while to find it. And with this message, I had also to find 
out what did go wrong.

How about: ("Unexpected junk after %s at %L", 
expr->n.symtree->sym->name, &expr->where)? – or "Unexpected junk in 
reference to %s at %L"?

Or deviating from your current error messages: ""Inconsistent use of %s 
at %L"

(Side note: I think we have the general problem that expr->where does 
not start after the white space, which can be slightly confusing.)

Cheers,

Tobias



More information about the Gcc-patches mailing list