public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/50499] New: segmentation fault in gcc.dg/compat/struct-by-value-1 c_compat_x_tst.o-c_compat_y_tst.o with ppc -m64
@ 2011-09-23 22:08 vries at gcc dot gnu.org
  2011-09-23 22:11 ` [Bug target/50499] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2011-09-23 22:08 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50499
           Summary: segmentation fault in gcc.dg/compat/struct-by-value-1
                    c_compat_x_tst.o-c_compat_y_tst.o with ppc -m64
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vries@gcc.gnu.org


The relevant C code from the testcase is this:
...
struct S50 {
  unsigned char i[50];
}

void init50 (struct S50 *p, int i) {
  int j;
  for (j = 0; j < 50; j++)
    p->i[j] = i + j;
}

void check50 (struct S50 x, int i) {
  int j;
  for (j = 0; j < 50; j++)
    if (x.i[j] != i + j)
      abort ();
}

struct S50 g1s50, g2s50, g3s50;

void checkg50 (void) {
  check50 (g1s50, 64);
  check50 (g2s50, 128);
  check50 (g3s50, 192);
}

void testit50 (void) {

  init50 (&g1s50, 64);
  init50 (&g2s50, 128);
  init50 (&g3s50, 192);
  checkg50 ();
  test50 (g1s50, g2s50, g3s50);
  test2_50 (g1s50, g3s50);
}
...

In checkg50, the code for the second call to check50 looks like this:
...
        addis 9,2,.LC152@toc@ha
        mr 0,9
        mr 11,0
        ld 0,.LC152@toc@l(11)
        mr 9,0
        ld 3,0(9)
        mr 11,0
        ld 4,8(11)
        mr 9,0
        ld 5,16(9)
        mr 11,0
        ld 6,24(11)
        mr 9,0
        ld 7,32(9)
        mr 11,0
        ld 8,40(11)
        mr 11,0
        ld 9,48(11)
        li 10,192
        bl check50
...

I ran into a segmentation fault while executing 'ld 9,48(11)', the last load.

The LC152 data referenced is declared here:
...
.LC150:
        .tc g1s50[TC],g1s50
.LC151:
        .tc g2s50[TC],g2s50
.LC152:
        .tc g3s50[TC],g3s50
        .section        ".text"
...

and defined here:
...
        .comm   g1s50,50,1
        .comm   g2s50,50,1
        .comm   g3s50,50,1
...

So g2s50 is only 50 chars big, but we try to read 52 chars from it. We happen
not to have access to the 2 extra chars, and this causes the segmentation
violation.


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

* [Bug target/50499] segmentation fault in gcc.dg/compat/struct-by-value-1 c_compat_x_tst.o-c_compat_y_tst.o with ppc -m64
  2011-09-23 22:08 [Bug target/50499] New: segmentation fault in gcc.dg/compat/struct-by-value-1 c_compat_x_tst.o-c_compat_y_tst.o with ppc -m64 vries at gcc dot gnu.org
@ 2011-09-23 22:11 ` vries at gcc dot gnu.org
  2011-09-23 22:14 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2011-09-23 22:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from vries at gcc dot gnu.org 2011-09-23 22:08:12 UTC ---
Created attachment 25352
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25352
preprocessed struct-by-value-1_y.c

to reproduce:
$ powerpc-linux-gnu-gcc -c-m64 struct-by-value-1_y.c -save-temps


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

* [Bug target/50499] segmentation fault in gcc.dg/compat/struct-by-value-1 c_compat_x_tst.o-c_compat_y_tst.o with ppc -m64
  2011-09-23 22:08 [Bug target/50499] New: segmentation fault in gcc.dg/compat/struct-by-value-1 c_compat_x_tst.o-c_compat_y_tst.o with ppc -m64 vries at gcc dot gnu.org
  2011-09-23 22:11 ` [Bug target/50499] " vries at gcc dot gnu.org
@ 2011-09-23 22:14 ` vries at gcc dot gnu.org
  2012-02-02 15:07 ` bergner at gcc dot gnu.org
  2012-02-02 15:09 ` bergner at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2011-09-23 22:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from vries at gcc dot gnu.org 2011-09-23 22:10:51 UTC ---
gcc -v configure line:
...
Configured with:
/scratch/vries/b6/pr43864.42.all-fsf-mainline-powerpc-linux-gnu.cfg/src/gcc-mainline/configure
--build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=powerpc-linux-gnu
--enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch
--enable-checking=yes,rtl --with-long-double-128 --enable-targets=all
--with-gnu-as --with-gnu-ld --enable-languages=c,c++ --enable-shared
--enable-lto --enable-symvers=gnu --enable-__cxa_atexit --disable-nls
--prefix=/opt/codesourcery
--with-sysroot=/opt/codesourcery/powerpc-linux-gnu/libc
--with-build-sysroot=/scratch/vries/b6/pr43864.42.all-fsf-mainline-powerpc-linux-gnu.cfg/install/powerpc-linux-gnu/libc
--with-gmp=/scratch/vries/b6/pr43864.42.all-fsf-mainline-powerpc-linux-gnu.cfg/obj/host-libs-mainline-0-powerpc-linux-gnu-i686-pc-linux-gnu/usr
--with-mpfr=/scratch/vries/b6/pr43864.42.all-fsf-mainline-powerpc-linux-gnu.cfg/obj/host-libs-mainline-0-powerpc-linux-gnu-i686-pc-linux-gnu/usr
--with-mpc=/scratch/vries/b6/pr43864.42.all-fsf-mainline-powerpc-linux-gnu.cfg/obj/host-libs-mainline-0-powerpc-linux-gnu-i686-pc-linux-gnu/usr
--with-ppl=/scratch/vries/b6/pr43864.42.all-fsf-mainline-powerpc-linux-gnu.cfg/obj/host-libs-mainline-0-powerpc-linux-gnu-i686-pc-linux-gnu/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
--with-cloog=/scratch/vries/b6/pr43864.42.all-fsf-mainline-powerpc-linux-gnu.cfg/obj/host-libs-mainline-0-powerpc-linux-gnu-i686-pc-linux-gnu/usr
--with-libelf=/scratch/vries/b6/pr43864.42.all-fsf-mainline-powerpc-linux-gnu.cfg/obj/host-libs-mainline-0-powerpc-linux-gnu-i686-pc-linux-gnu/usr
--disable-libgomp --enable-poison-system-directories
--with-build-time-tools=/scratch/vries/b6/pr43864.42.all-fsf-mainline-powerpc-linux-gnu.cfg/install/powerpc-linux-gnu/bin
--with-build-time-tools=/scratch/vries/b6/pr43864.42.all-fsf-mainline-powerpc-linux-gnu.cfg/install/powerpc-linux-gnu/bin
...


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

* [Bug target/50499] segmentation fault in gcc.dg/compat/struct-by-value-1 c_compat_x_tst.o-c_compat_y_tst.o with ppc -m64
  2011-09-23 22:08 [Bug target/50499] New: segmentation fault in gcc.dg/compat/struct-by-value-1 c_compat_x_tst.o-c_compat_y_tst.o with ppc -m64 vries at gcc dot gnu.org
  2011-09-23 22:11 ` [Bug target/50499] " vries at gcc dot gnu.org
  2011-09-23 22:14 ` vries at gcc dot gnu.org
@ 2012-02-02 15:07 ` bergner at gcc dot gnu.org
  2012-02-02 15:09 ` bergner at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: bergner at gcc dot gnu.org @ 2012-02-02 15:07 UTC (permalink / raw)
  To: gcc-bugs

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

Peter Bergner <bergner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #3 from Peter Bergner <bergner at gcc dot gnu.org> 2012-02-02 15:07:34 UTC ---
This is a duplicate of PR36043.

*** This bug has been marked as a duplicate of bug 36043 ***


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

* [Bug target/50499] segmentation fault in gcc.dg/compat/struct-by-value-1 c_compat_x_tst.o-c_compat_y_tst.o with ppc -m64
  2011-09-23 22:08 [Bug target/50499] New: segmentation fault in gcc.dg/compat/struct-by-value-1 c_compat_x_tst.o-c_compat_y_tst.o with ppc -m64 vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-02-02 15:07 ` bergner at gcc dot gnu.org
@ 2012-02-02 15:09 ` bergner at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: bergner at gcc dot gnu.org @ 2012-02-02 15:09 UTC (permalink / raw)
  To: gcc-bugs

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

Peter Bergner <bergner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

--- Comment #4 from Peter Bergner <bergner at gcc dot gnu.org> 2012-02-02 15:08:50 UTC ---
Closing as duplicate.


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

end of thread, other threads:[~2012-02-02 15:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-23 22:08 [Bug target/50499] New: segmentation fault in gcc.dg/compat/struct-by-value-1 c_compat_x_tst.o-c_compat_y_tst.o with ppc -m64 vries at gcc dot gnu.org
2011-09-23 22:11 ` [Bug target/50499] " vries at gcc dot gnu.org
2011-09-23 22:14 ` vries at gcc dot gnu.org
2012-02-02 15:07 ` bergner at gcc dot gnu.org
2012-02-02 15:09 ` bergner 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).