public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/31030]  New: [Regression 4.3] Segmentation fault of compiled program with -O2
@ 2007-03-03 12:10 burnus at gcc dot gnu dot org
  2007-03-09 22:49 ` [Bug middle-end/31030] [4.3 Regression] Segmentation fault " burnus at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-03 12:10 UTC (permalink / raw)
  To: gcc-bugs

This is with the Polyhedron Fortran Benchmark,
http://www.polyhedron.com/pb05/polyhedron_benchmark_suite.html
http://www.polyhedron.com/pb05/pb05.zip

The test is in ./pb06/lin/source/.

gfortran -g -O1 linpk.f90
./a.out
runs without any error.

gfortran -g -O2 linpk.f90
./a.out
gives a segmentation fault.

Analogously for test_fpu and rnflow.

The regression must have happened between 2007-03-02-r122469 and
2007-03-03-r122499.

valgrind output for linpk.f90 with -O2 (no error for -O1):

==27168== Invalid read of size 8
==27168==    at 0x400CD2: dscal_ (linpk.f90:424)
==27168==    by 0x401C06: dgefa_ (linpk.f90:151)
==27168==    by 0x401DC0: MAIN__ (linpk.f90:14)
==27168==    by 0x40204D: main (fmain.c:18)
==27168==  Address 0x35B7000 is not stack'd, malloc'd or (recently) free'd
==27168==
==27168== Process terminating with default action of signal 11 (SIGSEGV):
dumping core
==27168==  Access not within mapped region at address 0x35B7000
==27168==    at 0x400CD2: dscal_ (linpk.f90:424)
==27168==    by 0x401C06: dgefa_ (linpk.f90:151)
==27168==    by 0x401DC0: MAIN__ (linpk.f90:14)
==27168==    by 0x40204D: main (fmain.c:18)


-- 
           Summary: [Regression 4.3] Segmentation fault of compiled program
                    with -O2
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug middle-end/31030] [4.3 Regression] Segmentation fault with -O2
  2007-03-03 12:10 [Bug middle-end/31030] New: [Regression 4.3] Segmentation fault of compiled program with -O2 burnus at gcc dot gnu dot org
@ 2007-03-09 22:49 ` burnus at gcc dot gnu dot org
  2007-03-09 22:51 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-09 22:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-03-09 22:49 -------
For completeness: This is on x86_64-unknown-linux-gnu


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
            Summary|[Regression 4.3]            |[4.3 Regression]
                   |Segmentation fault of       |Segmentation fault with -O2
                   |compiled program with -O2   |


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


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

* [Bug middle-end/31030] [4.3 Regression] Segmentation fault with -O2
  2007-03-03 12:10 [Bug middle-end/31030] New: [Regression 4.3] Segmentation fault of compiled program with -O2 burnus at gcc dot gnu dot org
  2007-03-09 22:49 ` [Bug middle-end/31030] [4.3 Regression] Segmentation fault " burnus at gcc dot gnu dot org
@ 2007-03-09 22:51 ` pinskia at gcc dot gnu dot org
  2007-03-10 10:49 ` dominiq at lps dot ens dot fr
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-03-09 22:51 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

* [Bug middle-end/31030] [4.3 Regression] Segmentation fault with -O2
  2007-03-03 12:10 [Bug middle-end/31030] New: [Regression 4.3] Segmentation fault of compiled program with -O2 burnus at gcc dot gnu dot org
  2007-03-09 22:49 ` [Bug middle-end/31030] [4.3 Regression] Segmentation fault " burnus at gcc dot gnu dot org
  2007-03-09 22:51 ` pinskia at gcc dot gnu dot org
@ 2007-03-10 10:49 ` dominiq at lps dot ens dot fr
  2007-03-11 12:58 ` dominiq at lps dot ens dot fr
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-03-10 10:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dominiq at lps dot ens dot fr  2007-03-10 10:49 -------
Confirmed on OSX 10.3.9 with snapshot 4.3.0 20070309.


-- 

dominiq at lps dot ens dot fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dominiq at lps dot ens dot
                   |                            |fr


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


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

* [Bug middle-end/31030] [4.3 Regression] Segmentation fault with -O2
  2007-03-03 12:10 [Bug middle-end/31030] New: [Regression 4.3] Segmentation fault of compiled program with -O2 burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-03-10 10:49 ` dominiq at lps dot ens dot fr
@ 2007-03-11 12:58 ` dominiq at lps dot ens dot fr
  2007-03-11 13:16 ` dominiq at lps dot ens dot fr
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-03-11 12:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dominiq at lps dot ens dot fr  2007-03-11 12:58 -------
The following reduced test case

      PROGRAM LINPK
      PARAMETER (N=2500,LDA=N+1)
      DOUBLE PRECISION a(LDA,N) , b(N) , x(N)

      a = 1.0
      print *, 'before DSCAL'
      CALL DSCAL(N-1,1.0D0,A(2,1),1)
      print *, 'after DSCAL'

      END

      SUBROUTINE DSCAL(N,Da,Dx,Incx)
      DOUBLE PRECISION Da , Dx(*)
      INTEGER i , Incx , m , mp1 , N , nincx

!      print *, N, Da, Dx(MOD(N,5)+1), Incx
      IF ( N.GT.0 ) THEN
            mp1 = MOD(N,5) + 1
            DO i = mp1 , N , 5
               Dx(i) = Da*Dx(i)
            ENDDO
      ENDIF
      END

shows the bug:

[karma] lin/source% gfc -O2 linpk_red.f90
[karma] lin/source% a.out 
 before DSCAL
Bus error

Looking at linpk_red.f90.116t.optimized, the loop in DSCAL reads

<L2>:;
  D.1053 = (<unnamed type>) ivtmp.54;
  MEM[index: D.1053] = pretmp.36 * MEM[index: D.1053];
  ivtmp.45 = ivtmp.45 + 1;
  ivtmp.54 = ivtmp.54 + 40;
  if (ivtmp.45 == 2147483647) goto L.4; else goto <L2>;

I don't know the origin of 2147483647, but it looks pretty bad!-(even for me)

Note that DSCAL appears in linpk.f90, rnflow.f90, and test_fpu.f90.

PS this is my second attempt to post this, I apologize if the first one shows
up later.


-- 


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


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

* [Bug middle-end/31030] [4.3 Regression] Segmentation fault with -O2
  2007-03-03 12:10 [Bug middle-end/31030] New: [Regression 4.3] Segmentation fault of compiled program with -O2 burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-03-11 12:58 ` dominiq at lps dot ens dot fr
@ 2007-03-11 13:16 ` dominiq at lps dot ens dot fr
  2007-03-11 14:07 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-03-11 13:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dominiq at lps dot ens dot fr  2007-03-11 13:16 -------
Note that the bug affect lapack/blas/{s,d}scal.f. Note also that in the
*optimized* dumps of
lapack/blas/{c,z}scal.f there are several:

Invalid sum of incoming frequencies xxxx, should be xxxx

cscal.f:

...
Invalid sum of incoming frequencies 2224, should be 2116
<L19>:;
  D.1073 = (<unnamed type>) ivtmp.47;
  CR.63 = MEM[index: D.1073];
  CI.64 = MEM[index: D.1073, offset: 4];
  MEM[index: D.1073] = CR.61 * CR.63 - CI.62 * CI.64;
  MEM[index: D.1073, offset: 4] = CR.61 * CI.64 + CI.62 * CR.63;
  ivtmp.44 = ivtmp.44 + 1;
  ivtmp.47 = ivtmp.47 + 8;
  if ((int4) ivtmp.44 == D.968) goto <L14>; else goto <L19>;

Invalid sum of incoming frequencies 2322, should be 2430
<L14>:;
  return;

and zscal.f:

...
Invalid sum of incoming frequencies 10511, should be 10000
<L24>:;
  D.1095 = (<unnamed type>) ivtmp.59;
  CR.21 = MEM[index: D.1095];
  CI.22 = MEM[index: D.1095, offset: 8];
  MEM[index: D.1095] = CR.64 * CR.21 - CI.65 * CI.22;
  MEM[index: D.1095, offset: 8] = CR.64 * CI.22 + CI.65 * CR.21;
  ivtmp.53 = ivtmp.53 + 1;
  ivtmp.59 = ivtmp.59 + ivtmp.62;
  if ((int4) ivtmp.53 == D.967) goto <L16>; else goto <L24>;

<L29>:;
  CR.19 = REALPART_EXPR <*za>;
  CI.20 = IMAGPART_EXPR <*za>;
  ivtmp.50 = (<unnamed type>) &REALPART_EXPR <(*zx)[0]>;
  ivtmp.47 = 0;

Invalid sum of incoming frequencies 4723, should be 4493
<L23>:;
  D.1079 = (<unnamed type>) ivtmp.50;
  CR.25 = MEM[index: D.1079];
  CI.26 = MEM[index: D.1079, offset: 8];
  MEM[index: D.1079] = CR.19 * CR.25 - CI.20 * CI.26;
  MEM[index: D.1079, offset: 8] = CR.19 * CI.26 + CI.20 * CR.25;
  ivtmp.47 = ivtmp.47 + 1;
  ivtmp.50 = ivtmp.50 + 16;
  if ((int4) ivtmp.47 == D.967) goto <L16>; else goto <L23>;

Invalid sum of incoming frequencies 4420, should be 5160
<L16>:;
  return;


-- 


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


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

* [Bug middle-end/31030] [4.3 Regression] Segmentation fault with -O2
  2007-03-03 12:10 [Bug middle-end/31030] New: [Regression 4.3] Segmentation fault of compiled program with -O2 burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-03-11 13:16 ` dominiq at lps dot ens dot fr
@ 2007-03-11 14:07 ` burnus at gcc dot gnu dot org
  2007-03-11 20:46 ` ian at airs dot com
  2007-03-11 21:42 ` burnus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-11 14:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2007-03-11 14:07 -------
Ian, looking at the changelog, it seems as if your commit
http://gcc.gnu.org/viewcvs?view=rev&revision=122487
r122487 | ian | 2007-03-02 21:09:31 +0100 (Fri, 02 Mar 2007) | 35 lines
        Used signed infinities in VRP.
could be the cause of this problem.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-03-11 14:07:33
               date|                            |


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


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

* [Bug middle-end/31030] [4.3 Regression] Segmentation fault with -O2
  2007-03-03 12:10 [Bug middle-end/31030] New: [Regression 4.3] Segmentation fault of compiled program with -O2 burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-03-11 14:07 ` burnus at gcc dot gnu dot org
@ 2007-03-11 20:46 ` ian at airs dot com
  2007-03-11 21:42 ` burnus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ian at airs dot com @ 2007-03-11 20:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ian at airs dot com  2007-03-11 20:46 -------
Can you see if the patch I committed this morning fixes this problem?

2007-03-11  Ian Lance Taylor  <iant@google.com>

        * tree-vrp.c (vrp_int_const_binop): Handle PLUS_EXPR and
        the *_DIV_EXPR codes correctly with overflow infinities.

Thanks.


-- 


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


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

* [Bug middle-end/31030] [4.3 Regression] Segmentation fault with -O2
  2007-03-03 12:10 [Bug middle-end/31030] New: [Regression 4.3] Segmentation fault of compiled program with -O2 burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-03-11 20:46 ` ian at airs dot com
@ 2007-03-11 21:42 ` burnus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-11 21:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2007-03-11 21:42 -------
> Can you see if the patch I committed this morning fixes this problem?
http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00664.html

Yes, the patch fixes this problem. Thanks!


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2007-03-11 21:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-03 12:10 [Bug middle-end/31030] New: [Regression 4.3] Segmentation fault of compiled program with -O2 burnus at gcc dot gnu dot org
2007-03-09 22:49 ` [Bug middle-end/31030] [4.3 Regression] Segmentation fault " burnus at gcc dot gnu dot org
2007-03-09 22:51 ` pinskia at gcc dot gnu dot org
2007-03-10 10:49 ` dominiq at lps dot ens dot fr
2007-03-11 12:58 ` dominiq at lps dot ens dot fr
2007-03-11 13:16 ` dominiq at lps dot ens dot fr
2007-03-11 14:07 ` burnus at gcc dot gnu dot org
2007-03-11 20:46 ` ian at airs dot com
2007-03-11 21:42 ` burnus 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).