public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53793] New: [ARM] Debug info is wrong at optimization level -O1
@ 2012-06-28  7:19 shafitvm at gmail dot com
  2012-06-28  9:31 ` [Bug target/53793] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: shafitvm at gmail dot com @ 2012-06-28  7:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53793

             Bug #: 53793
           Summary: [ARM] Debug info is wrong at optimization level -O1
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: shafitvm@gmail.com


Compiler:

Arm linaro
Target: arm-none-eabi
Configured with:
/home/rat031/arm_gcc_051612/gcc-arm-none-eabi-4_6-2012q1-20120316/src/gcc/configure
--build=i686-linux-gnu --host=i686-pc-mingw32 --target=arm-none-eabi
--prefix=/home/rat031/arm_gcc_051612/gcc-arm-none-eabi-4_6-2012q1-20120316/install-mingw
--enable-languages=c,c++ --disable-decimal-float --disable-libffi
--disable-libgomp --disable-libmudflap --disable-libquadmath
--disable-libssp --disable-libstdcxx-pch --disable-lto --disable-nls
--disable-shared --disable-threads --disable-tls --with-gnu-as
--with-gnu-ld --with-headers=yes --with-newlib
--with-sysroot=/home/rat031/arm_gcc_051612/gcc-arm-none-eabi-4_6-2012q1-20120316/install-mingw/arm-none-eabi
--with-libiconv-prefix=/home/rat031/arm_gcc_051612/gcc-arm-none-eabi-4_6-2012q1-20120316/build-mingw/host-libs/usr
--with-gmp=/home/rat031/arm_gcc_051612/gcc-arm-none-eabi-4_6-2012q1-20120316/build-mingw/host-libs/usr
--with-mpfr=/home/rat031/arm_gcc_051612/gcc-arm-none-eabi-4_6-2012q1-20120316/build-mingw/host-libs/usr
--with-mpc=/home/rat031/arm_gcc_051612/gcc-arm-none-eabi-4_6-2012q1-20120316/build-mingw/host-libs/usr
--with-ppl=/home/rat031/arm_gcc_051612/gcc-arm-none-eabi-4_6-2012q1-20120316/build-mingw/host-libs/usr
--with-cloog=/home/rat031/arm_gcc_051612/gcc-arm-none-eabi-4_6-2012q1-20120316/build-mingw/host-libs/usr
--with-libelf=/home/rat031/arm_gcc_051612/gcc-arm-none-eabi-4_6-2012q1-20120316/build-mingw/host-libs/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic
-lm' --with-pkgversion='GNU Tools for ARM Embedded Processors'
--with-extra-multilibs=armv6-m,armv7-m,armv7e-m,armv7-r
Thread model: single
gcc version 4.6.2 20120316 (release) [ARM/embedded-4_6-branch revision
185452] (GNU Tools for ARM Embedded Processors)


invocation line:
arm-none-eabi-gcc -Wl,-Map=output.map -mcpu=cortex-m0 -mthumb
-specs=rdimon.specs -lrdimon -lc -lrdimon test.c -g3 -gdwarf-2 -O1  -o
test.elf --save-temps -dA

Code:

void variables_local();

int main(void)
{
       variables_local();
       return 0;
}



void variables_local()
{
       volatile int SizeOfInt  = sizeof (int);
       volatile int lint = 1024;
       volatile float lfloat = 55.55f;
       volatile double ldouble = 222.222;
       volatile long llong = 123456789;
       volatile unsigned luint = 256;
       volatile char lchar = 'a';
       volatile char *lstring = "hello";
       volatile char mlarray[8] = "testing";
       return;
}

gdb output:

Breakpoint 1, main () at test.c:14
14              variables_local();
(gdb) s
variables_local () at test.c:22
22              volatile int SizeOfInt  = sizeof (int);
(gdb) s
23              volatile int lint = 1024;
(gdb) p SizeOfInt
$1 = 39211
(gdb) s
24              volatile float lfloat = 55.55f;
(gdb) p lint
$2 = 0
(gdb) s
25              volatile double ldouble = 222.222;
(gdb) p lfloat
$3 = 5.60519386e-045
(gdb) s
26              volatile long llong = 123456789;
(gdb) p ldouble
$4 = 518831996932.39624
(gdb) s
27              volatile unsigned luint = 256;
(gdb) p llong
$5 = 1080805146
(gdb) s
28              volatile char lchar = 'a';
(gdb) p luint
$6 = 2680059593
(gdb) s
30              volatile char mlarray[8] = "testing";
(gdb) p lchar
$7 = 97 'a'
(gdb) s
32      }
(gdb) p lchar
$8 = 159 'Y'
(gdb) p lint
$9 = 0
(gdb) p luint
$10 = 2680059593
(gdb)

Issue:

I think dwarf info generated doesn't take into account the push/pop instruction

variables_local:
.LFB1:
       .file 1 "../Sources/main.c"
       @ ../Sources/main.c:21
       .loc 1 21 0
       .cfi_startproc
       push    {r4, lr}
.LCFI0:
       .cfi_def_cfa_offset 8
       .cfi_offset 4, -8
       .cfi_offset 14, -4
       @ basic block 2
       sub     sp, sp, #16
.LCFI1:
       .cfi_def_cfa_offset 24
       @ ../Sources/main.c:22
       .loc 1 22 0
       mov     r3, #4
       str     r3, [sp, #12]
.LVL0:

I see that in prologue/epilogue push/pop instructions are directly emitted on
to output file using asm_print, rather than into the rtl steam. Hence the dwarf
info generation code is not aware of such instructions.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/53793] [ARM] Debug info is wrong at optimization level -O1
  2012-06-28  7:19 [Bug c/53793] New: [ARM] Debug info is wrong at optimization level -O1 shafitvm at gmail dot com
@ 2012-06-28  9:31 ` rguenth at gcc dot gnu.org
  2012-06-28 11:15 ` shafitvm at gmail dot com
  2014-03-20 19:47 ` ramana at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-28  9:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53793

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-28 09:30:55 UTC ---
That's a general issue of the old, deprecated text prologues/epilogues.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/53793] [ARM] Debug info is wrong at optimization level -O1
  2012-06-28  7:19 [Bug c/53793] New: [ARM] Debug info is wrong at optimization level -O1 shafitvm at gmail dot com
  2012-06-28  9:31 ` [Bug target/53793] " rguenth at gcc dot gnu.org
@ 2012-06-28 11:15 ` shafitvm at gmail dot com
  2014-03-20 19:47 ` ramana at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: shafitvm at gmail dot com @ 2012-06-28 11:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53793

--- Comment #2 from Mohamed Shafi <shafitvm at gmail dot com> 2012-06-28 11:15:18 UTC ---
So this is fixed in 4.7 then. Any plan to back port this?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/53793] [ARM] Debug info is wrong at optimization level -O1
  2012-06-28  7:19 [Bug c/53793] New: [ARM] Debug info is wrong at optimization level -O1 shafitvm at gmail dot com
  2012-06-28  9:31 ` [Bug target/53793] " rguenth at gcc dot gnu.org
  2012-06-28 11:15 ` shafitvm at gmail dot com
@ 2014-03-20 19:47 ` ramana at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ramana at gcc dot gnu.org @ 2014-03-20 19:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53793

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |ramana at gcc dot gnu.org
         Resolution|---                         |WONTFIX

--- Comment #3 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
(In reply to Mohamed Shafi from comment #2)
> So this is fixed in 4.7 then. Any plan to back port this?

No plans to backport any of the prologue / epilogue stuff into 4.6. If you see
problems in more recent compilers please raise a bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-20 19:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-28  7:19 [Bug c/53793] New: [ARM] Debug info is wrong at optimization level -O1 shafitvm at gmail dot com
2012-06-28  9:31 ` [Bug target/53793] " rguenth at gcc dot gnu.org
2012-06-28 11:15 ` shafitvm at gmail dot com
2014-03-20 19:47 ` ramana at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).