Who should set main_input_filename to "<stdin>"?

Roger Sayle roger@eyesopen.com
Sat Sep 27 20:13:00 GMT 2003


Whilst debugging in gdb, I accidentally ran the command "jc1 -O2",
i.e. without a filename, only to discover than jc1 ICEs.  Similar
tests reveal that mainline f771 also ICEs, but neither did back
in gcc 3.2.  I then tried to discover why neither cc1 nor cc1plus
currently ICE, which revealed that mysteriously for the C-family
front-ends, main_input_filename gets set to "<stdin>" as an
undocumented side-effect of linemap_add in linemap.c.

I was wondering which routine *should* be responsible for setting
input filename?  Should java and fortran be calling linemap earlier?
Should "default_file_start" in varasm.c call output_file_directive
when main_input_filename is NULL?  Or if so, is it reasonable to
generate ".file <stdin>" in asm_out_file.  Do java_parse_file and
ffe_parse_file now need to defend against NULL filenames?

This is one of those pan front-end problems that its difficult to
file as a f77 or java PR, as neither of them is at fault: something
else has obviously changed in toplev.c.  I'm happy to investigate
a fix myself, but I don't yet know what the intended behaviour is
(or should be)?

Roger
--



More information about the Gcc-patches mailing list