public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "shafitvm at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/53793] New: [ARM] Debug info is wrong at optimization level -O1
Date: Thu, 28 Jun 2012 07:19:00 -0000	[thread overview]
Message-ID: <bug-53793-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2012-06-28  7:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28  7:19 shafitvm at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-53793-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).