Bug 39527 - wrong function name and line numbers with -g -O2 option
Summary: wrong function name and line numbers with -g -O2 option
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 39535 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-03-23 12:39 UTC by M R Swami Reddy
Modified: 2009-03-24 05:16 UTC (History)
2 users (show)

See Also:
Host: Native Linux
Target: crx-elf
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description M R Swami Reddy 2009-03-23 12:39:56 UTC
With -g -O2 option, crx-elf-gcc generates wrong line numbers and function names.
==
/tmp/ccrrZsJf.o: In function `090312 (experimental)':
/home10/swami/test.c:5: undefined reference to `_f1'
collect2: ld returned 1 exit status
===

Expected output could be:
===
/tmp/ccEJcFRs.o: In function `main':
/home10/swami/test.c:6: undefined reference to `_f1'
collect2: ld returned 1 exit status
----


testcase: "test.c"
====

int f = 1;
extern int f1 ();

main () {
   f1();
}
===
Comment 1 Richard Biener 2009-03-23 13:47:37 UTC
This is a binutils issue.  The error is reported with the location of the
calling function, not the call.
Comment 2 M R Swami Reddy 2009-03-24 04:51:54 UTC
Subject: Re:  wrong function name and line numbers with
 -g -O2 option

rguenth at gcc dot gnu dot org wrote:
> 
> ------- Comment #1 from rguenth at gcc dot gnu dot org  2009-03-23 13:47 -------
> This is a binutils issue.  The error is reported with the location of the
> calling function, not the call.


Yes, this issue need to fixed in gcc and binutils also. I am working on this 
issue and will send the patch soon.

Thanks
Swami


Comment 3 Andrew Pinski 2009-03-24 05:16:39 UTC
*** Bug 39535 has been marked as a duplicate of this bug. ***