Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!tut.cis.ohio-state.edu!sysrap.ks.fujitsu.junet!seki From: seki@sysrap.ks.fujitsu.junet (Masahiro SEKIGUCHI) Newsgroups: gnu.gcc.bug Subject: gcc 1.36 SDB info bug Message-ID: <8911150600.AA00573@seki.sysrap.ks.fujitsu.co.jp> Date: 15 Nov 89 06:00:48 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: Architecture Dept., R&P Div., Fujitsu Limited Lines: 83 OUTLINE Gcc generates negative line numbers in SDB debugging informations, when an inline function defined in an include file is called. DETAILS The compiler was built with ``config.gcc i386v'' from unmodified sources of gcc 1.36. Compiling the following file ``test.c'' causes the following file ``test.s'' as an output. Used command line is: gcc -v -S -g test.c ``test.s'' includes two wrong directive ``.line -1'' between lines ``.L3:'' and ``.L4:''. My assembler reported errors for ``.line -1''. I don't know whether it is a common feature of System V or it is a bug of my assembler. Please ignore this report if negative line numbers should be accepted, and so, it is not a bug of gcc. --- test.c #include "test.h" main () { int n; n = test(); } --- test.h static int inline test () { return 1; } --- test.s .file "test.c" gcc_compiled.: .text .align 4 .def main; .val main; .scl 2; .type 044; .endef .globl main main: .ln 1 pushl %ebp movl %esp,%ebp subl $4,%esp .def .bf; .val .; .scl 101; .line 3; .endef .def .bb; .val .; .scl 100; .line 1; .endef .def n; .val -4; .scl 1; .type 04; .endef .ln 2 .def .bb; .val .; .scl 100; .line 2; .endef leal -4(%ebp),%eax movl $1,%eax jmp .L4 .L4: .def .eb;.val .; .scl 100; .line -1; .endef movl %eax,-4(%ebp) .def .eb;.val .; .scl 100; .line -1; .endef .ln 3 .L3: .def .ef; .val .; .scl 101; .line 3; .endef leave ret .def main; .val .; .scl -1; .endef GUESS I think this error is a result of relative line number culculation. Gcc subtracts a line number in test.h from a line number in test.c to get a ``relative'' line number. In this case, a statement is in an inline function defined in test.h, while the top of the current function is in test.c My suggestion is to change some codes in sdbout.c to use ``dummy'' line numbers if an inline function defined in an include file is used. I found similar fix in the file final.c, which is just before the call to ASM_OUTPUT_SOUECE_LINE, while the fix was erased out. -- Masahiro Sekiguchi Architecture Dept., R&P Div., Fujitsu Limited seki@sysrap.ks.fujitsu.co.jp (JUNET) -or- PDB01144 (NIFTY-Serve)