public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/33610]  New: Access to long double struct member from nested procedure crashes
@ 2007-10-01 16:10 peter_schorn at yahoo dot com
  2007-10-01 16:11 ` [Bug c/33610] " peter_schorn at yahoo dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: peter_schorn at yahoo dot com @ 2007-10-01 16:10 UTC (permalink / raw)
  To: gcc-bugs

Compile the following program:

#include <stdio.h>

long double d = 22092007.192016;

struct abc {
  long double a, b, c;
};

void outer(void) {
  struct abc x;

  void inner(struct abc p) {
    printf("Enter inner\n");
    /* Next line causes problem: bus error, segmentation fault or 
    result of comparison is false */
    if (x.a == d)
      printf("OK\n");
    else
      printf("Fail\n");
  }

  x.a = d;
  inner(x);
}

int main (int argc, const char * argv[]) {
  outer();
  return 0;
}

Compile

petersch% /Developer/Pascal/gpc421/bin/gcc -v -Wall -save-temps -o schorn3
schorn3.c
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: ../gcc-4.2.1/configure --enable-languages=c
--enable-threads=posix --target=powerpc-apple-darwin8
--host=powerpc-apple-darwin8 --build=powerpc-apple-darwin8
--prefix=/Developer/Pascal/gpc421n
Thread model: posix
gcc version 4.2.1
 /Developer/Pascal/gpc421/bin/../libexec/gcc/powerpc-apple-darwin8/4.2.1/cc1 -E
-quiet -v -iprefix
/Developer/Pascal/gpc421/bin/../lib/gcc/powerpc-apple-darwin8/4.2.1/
-D__DYNAMIC__ schorn3.c -fPIC -Wall -fpch-preprocess -o schorn3.i
ignoring nonexistent directory
"/Developer/Pascal/gpc421/bin/../lib/gcc/powerpc-apple-darwin8/4.2.1/../../../../powerpc-apple-darwin8/include"
ignoring nonexistent directory "/Developer/Pascal/gpc421n/include"
ignoring nonexistent directory
"/Developer/Pascal/gpc421n/lib/gcc/powerpc-apple-darwin8/4.2.1/include"
ignoring nonexistent directory
"/Developer/Pascal/gpc421n/powerpc-apple-darwin8/include"
#include "..." search starts here:
#include <...> search starts here:
 /Developer/Pascal/gpc421/bin/../lib/gcc/powerpc-apple-darwin8/4.2.1/include
 /usr/local/include
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
 /Developer/Pascal/gpc421/bin/../libexec/gcc/powerpc-apple-darwin8/4.2.1/cc1
-fpreprocessed schorn3.i -fPIC -quiet -dumpbase schorn3.c -auxbase schorn3
-Wall -version -o schorn3.s
GNU C version 4.2.1 (powerpc-apple-darwin8)
        compiled by GNU C version 4.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 08ab063eb304b807ad0f3113ee916e74
 as -arch ppc -o schorn3.o schorn3.s

/Developer/Pascal/gpc421/bin/../libexec/gcc/powerpc-apple-darwin8/4.2.1/collect2
-dynamic -arch ppc -weak_reference_mismatches non-weak -o schorn3 -lcrt1.o
/Developer/Pascal/gpc421/bin/../lib/gcc/powerpc-apple-darwin8/4.2.1/crt2.o
-L/Developer/Pascal/gpc421/bin/../lib/gcc/powerpc-apple-darwin8/4.2.1
-L/Developer/Pascal/gpc421/bin/../lib/gcc
-L/Developer/Pascal/gpc421/bin/../lib/gcc/powerpc-apple-darwin8/4.2.1/../../..
schorn3.o -lgcc -lSystemStubs -lSystem

Running it will create a "Bus error" or might print "Fail" or terminate with a
segmentation fault depending on the nature of the wrong address of x.a. The
problem disappears when compiling with -fpack-struct=4.

petersch% ./schorn3
Enter inner
Bus error
[petersch%


-- 
           Summary: Access to long double struct member from nested
                    procedure crashes
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: peter_schorn at yahoo dot com
 GCC build triplet: powerpc-apple-darwin8
  GCC host triplet: powerpc-apple-darwin8
GCC target triplet: powerpc-apple-darwin8


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


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

* [Bug c/33610] Access to long double struct member from nested procedure crashes
  2007-10-01 16:10 [Bug c/33610] New: Access to long double struct member from nested procedure crashes peter_schorn at yahoo dot com
@ 2007-10-01 16:11 ` peter_schorn at yahoo dot com
  2007-10-01 16:13 ` peter_schorn at yahoo dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: peter_schorn at yahoo dot com @ 2007-10-01 16:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from peter_schorn at yahoo dot com  2007-10-01 16:11 -------
Created an attachment (id=14278)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14278&action=view)
Source code of program showing the bug


-- 


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


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

* [Bug c/33610] Access to long double struct member from nested procedure crashes
  2007-10-01 16:10 [Bug c/33610] New: Access to long double struct member from nested procedure crashes peter_schorn at yahoo dot com
  2007-10-01 16:11 ` [Bug c/33610] " peter_schorn at yahoo dot com
@ 2007-10-01 16:13 ` peter_schorn at yahoo dot com
  2007-10-02  8:18 ` [Bug middle-end/33610] " gcc at microbizz dot nl
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: peter_schorn at yahoo dot com @ 2007-10-01 16:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from peter_schorn at yahoo dot com  2007-10-01 16:12 -------
Created an attachment (id=14279)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14279&action=view)
After pre-processing


-- 


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


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

* [Bug middle-end/33610] Access to long double struct member from nested procedure crashes
  2007-10-01 16:10 [Bug c/33610] New: Access to long double struct member from nested procedure crashes peter_schorn at yahoo dot com
  2007-10-01 16:11 ` [Bug c/33610] " peter_schorn at yahoo dot com
  2007-10-01 16:13 ` peter_schorn at yahoo dot com
@ 2007-10-02  8:18 ` gcc at microbizz dot nl
  2007-10-02  8:19 ` gcc at microbizz dot nl
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gcc at microbizz dot nl @ 2007-10-02  8:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from gcc at microbizz dot nl  2007-10-02 08:17 -------
Note that the problem also occurs on i386-apple-darwin with gcc-4.1.2.


-- 

gcc at microbizz dot nl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc at microbizz dot nl


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


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

* [Bug middle-end/33610] Access to long double struct member from nested procedure crashes
  2007-10-01 16:10 [Bug c/33610] New: Access to long double struct member from nested procedure crashes peter_schorn at yahoo dot com
                   ` (2 preceding siblings ...)
  2007-10-02  8:18 ` [Bug middle-end/33610] " gcc at microbizz dot nl
@ 2007-10-02  8:19 ` gcc at microbizz dot nl
  2007-10-02 19:51 ` andreast at gcc dot gnu dot org
  2008-12-31 18:18 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: gcc at microbizz dot nl @ 2007-10-02  8:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from gcc at microbizz dot nl  2007-10-02 08:19 -------
Also note that this is a regression from gcc-3.4.x where it worked fine.


-- 


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


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

* [Bug middle-end/33610] Access to long double struct member from nested procedure crashes
  2007-10-01 16:10 [Bug c/33610] New: Access to long double struct member from nested procedure crashes peter_schorn at yahoo dot com
                   ` (3 preceding siblings ...)
  2007-10-02  8:19 ` gcc at microbizz dot nl
@ 2007-10-02 19:51 ` andreast at gcc dot gnu dot org
  2008-12-31 18:18 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: andreast at gcc dot gnu dot org @ 2007-10-02 19:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from andreast at gcc dot gnu dot org  2007-10-02 19:51 -------
Works with O2/O3/Os on ppc-darwin 4.0.1 (Apple Computer, Inc. build 5367)
Fails with O/O0/O1 on ppc-darwin 4.0.1 (Apple Computer, Inc. build 5367)
Works with O/O1/O2/O3/Os on ppc-darwin gcc head 4.3.0 20071002
Fails with O0 on ppc-darwin gcc head 4.3.0 20071002

Works everywhere on i686-apple-darwin8, gcc 4.0.1 (Apple Computer, Inc. build
5370) and gcc head 4.3.0 20071002


-- 

andreast at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-10-02 19:51:41
               date|                            |


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


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

* [Bug middle-end/33610] Access to long double struct member from nested procedure crashes
  2007-10-01 16:10 [Bug c/33610] New: Access to long double struct member from nested procedure crashes peter_schorn at yahoo dot com
                   ` (4 preceding siblings ...)
  2007-10-02 19:51 ` andreast at gcc dot gnu dot org
@ 2008-12-31 18:18 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-31 18:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2008-12-31 18:16 -------


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


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-12-31 18:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-01 16:10 [Bug c/33610] New: Access to long double struct member from nested procedure crashes peter_schorn at yahoo dot com
2007-10-01 16:11 ` [Bug c/33610] " peter_schorn at yahoo dot com
2007-10-01 16:13 ` peter_schorn at yahoo dot com
2007-10-02  8:18 ` [Bug middle-end/33610] " gcc at microbizz dot nl
2007-10-02  8:19 ` gcc at microbizz dot nl
2007-10-02 19:51 ` andreast at gcc dot gnu dot org
2008-12-31 18:18 ` pinskia at gcc dot gnu dot 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).