public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/23453] New: [4.0 4.1 regression] miscompilation of PARI/GP on x86
@ 2005-08-18  7:30 debian-gcc at lists dot debian dot org
  2005-08-18  7:36 ` [Bug target/23453] [4.0/4.1 " debian-gcc at lists dot debian dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2005-08-18  7:30 UTC (permalink / raw)
  To: gcc-bugs

[forwarded from http://bugs.debian.org/309210]

rechecked with 4.0 CVS 20050816

wrong code for PARI/GP 2.2.10 on x86.
The pari source code can be found here:
<http://pari.math.u-bordeaux.fr/pub/pari/unstable/pari-2.2.10.alpha.tar.gz>

The problem is in the file src/basemath/alglin1.c, function ker0().

The compilation command used was:
gcc-4.0  -c -O3 -DGCC_INLINE -Wall -fno-strict-aliasing -fomit-frame-pointer
-DBOTH_GNUPLOT_AND_X11 -I. -I../src/headers  -o alglin1.o alglin1.i

using gcc-4.0 -O2 or gcc-3.4 -O3 generates correct code.

The problem can be reproduces running the gp interpreter:

1) download the tarball mentionned in the bug report and untar it
2) do 
CC=gcc-4.0 ./Configure
3) do 
make bench

One test-case fails (alglin).
Alternatively, you can do
make gp
./gp
matker([1,2;3,4])
  *** matker: bug in GP (Segmentation Fault), please report

More information about compiler options that fix this problem:
<http://pari.math.u-bordeaux.fr/archives/pari-dev-0505/msg00007.html>

> Can you make a stand-alone testcase?

Not at that time, unfortunately. The bug only occurs inside deeply inlined
code.

-- 
           Summary: [4.0 4.1 regression] miscompilation of PARI/GP on x86
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i486-linux


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


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

* [Bug target/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86
  2005-08-18  7:30 [Bug target/23453] New: [4.0 4.1 regression] miscompilation of PARI/GP on x86 debian-gcc at lists dot debian dot org
@ 2005-08-18  7:36 ` debian-gcc at lists dot debian dot org
  2005-08-18  7:42 ` debian-gcc at lists dot debian dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2005-08-18  7:36 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
      Known to fail|                            |4.0.2 4.1.0
      Known to work|                            |3.4.4
            Summary|[4.0 4.1 regression]        |[4.0/4.1 regression]
                   |miscompilation of PARI/GP on|miscompilation of PARI/GP on
                   |x86                         |x86


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


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

* [Bug target/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86
  2005-08-18  7:30 [Bug target/23453] New: [4.0 4.1 regression] miscompilation of PARI/GP on x86 debian-gcc at lists dot debian dot org
  2005-08-18  7:36 ` [Bug target/23453] [4.0/4.1 " debian-gcc at lists dot debian dot org
@ 2005-08-18  7:42 ` debian-gcc at lists dot debian dot org
  2005-08-18 12:15 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2005-08-18  7:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From debian-gcc at lists dot debian dot org  2005-08-18 07:36 -------
Created an attachment (id=9526)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9526&action=view)
preprocessed source


-- 


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


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

* [Bug target/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86
  2005-08-18  7:30 [Bug target/23453] New: [4.0 4.1 regression] miscompilation of PARI/GP on x86 debian-gcc at lists dot debian dot org
  2005-08-18  7:36 ` [Bug target/23453] [4.0/4.1 " debian-gcc at lists dot debian dot org
  2005-08-18  7:42 ` debian-gcc at lists dot debian dot org
@ 2005-08-18 12:15 ` pinskia at gcc dot gnu dot org
  2005-08-18 13:44 ` debian-gcc at lists dot debian dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-18 12:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-18 12:05 -------
We need at least a testcase which links.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Target Milestone|---                         |4.0.2


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


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

* [Bug target/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86
  2005-08-18  7:30 [Bug target/23453] New: [4.0 4.1 regression] miscompilation of PARI/GP on x86 debian-gcc at lists dot debian dot org
                   ` (2 preceding siblings ...)
  2005-08-18 12:15 ` pinskia at gcc dot gnu dot org
@ 2005-08-18 13:44 ` debian-gcc at lists dot debian dot org
  2005-08-18 21:41 ` [Bug rtl-optimization/23453] " belyshev at depni dot sinp dot msu dot ru
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2005-08-18 13:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From debian-gcc at lists dot debian dot org  2005-08-18 13:15 -------
testcase at http://people.debian.org/~doko/tmp/tst.tar.bz2


-- 


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


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

* [Bug rtl-optimization/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86
  2005-08-18  7:30 [Bug target/23453] New: [4.0 4.1 regression] miscompilation of PARI/GP on x86 debian-gcc at lists dot debian dot org
                   ` (3 preceding siblings ...)
  2005-08-18 13:44 ` debian-gcc at lists dot debian dot org
@ 2005-08-18 21:41 ` belyshev at depni dot sinp dot msu dot ru
  2005-08-19  1:09 ` [Bug rtl-optimization/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86 with gcse after reload belyshev at depni dot sinp dot msu dot ru
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: belyshev at depni dot sinp dot msu dot ru @ 2005-08-18 21:41 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
          Component|target                      |rtl-optimization
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-18 21:15:51
               date|                            |


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


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

* [Bug rtl-optimization/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86 with gcse after reload
  2005-08-18  7:30 [Bug target/23453] New: [4.0 4.1 regression] miscompilation of PARI/GP on x86 debian-gcc at lists dot debian dot org
                   ` (4 preceding siblings ...)
  2005-08-18 21:41 ` [Bug rtl-optimization/23453] " belyshev at depni dot sinp dot msu dot ru
@ 2005-08-19  1:09 ` belyshev at depni dot sinp dot msu dot ru
  2005-08-19 19:51 ` belyshev at depni dot sinp dot msu dot ru
  2005-09-27 16:24 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 12+ messages in thread
From: belyshev at depni dot sinp dot msu dot ru @ 2005-08-19  1:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From belyshev at depni dot sinp dot msu dot ru  2005-08-19 01:03 -------
Single-file testcase, compile with "-march=i486 -O2 -fomit-frame-pointer
-fno-strict-aliasing -fgcse-after-reload":

bar ()
{
  exit (0);
}

baz (x)
{
  return x;
}

foo ()
{
  abort ();
}

ker0 (int *x0, int a) 
{
  int *x, *c, *d, p, av, i, j, k, r, t, n, m, *dd;
  n = x0;
  m = x0 [0];
  x = baz (x0);
  if (a) 
    {
      if (m)
	foo ();
      for (k = 1; k <= n; k ++)
	((int **) x) [k] = foo (x [k]);
    }
  for (k = 1; k < m; k ++) 
    c [k] = 0;
  av = k;
  for (k = 0;; k ++) 
    {
      j = bar (x [k], 0, 0, 0);
      if (j > m) 
	{
	  r ++;
	  for (j = 1; j < k; j ++)
	    if (d [j])
	      ((int **) x) [k] [d [j]] = 0;
	}
      else
	{
	  foo (0, x [j]);
	  for (i = k + 1; i; i ++)
	    ((int *) x) [j] = 0;
	  for (t = 1; m; )
	    if (j) 
	      {
		p = x [t];
		for (i = k + 1; i; i ++)
		  x [t] = foo (x [i], foo (p, x [j]));
		if (av)
		  foo (k);
	      }
	}
    }
  *dd = r;
}

int main (void)
{
  int x = 0;
  ker0 (&x, 0);
  abort ();
}


-- 


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


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

* [Bug rtl-optimization/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86 with gcse after reload
  2005-08-18  7:30 [Bug target/23453] New: [4.0 4.1 regression] miscompilation of PARI/GP on x86 debian-gcc at lists dot debian dot org
                   ` (5 preceding siblings ...)
  2005-08-19  1:09 ` [Bug rtl-optimization/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86 with gcse after reload belyshev at depni dot sinp dot msu dot ru
@ 2005-08-19 19:51 ` belyshev at depni dot sinp dot msu dot ru
  2005-09-27 16:24 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 12+ messages in thread
From: belyshev at depni dot sinp dot msu dot ru @ 2005-08-19 19:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From belyshev at depni dot sinp dot msu dot ru  2005-08-19 19:51 -------
gcse after reload may move loads from stack around stack pointer changes. here
is simple workaround, it is supposed to prevent gcse after reload from touching
expressions containing stack pointer at all.

Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.359
diff -u -r1.359 cse.c
--- cse.c	29 Jul 2005 05:57:37 -0000	1.359
+++ cse.c	19 Aug 2005 19:33:49 -0000
@@ -2221,6 +2221,14 @@
 		return 0;
 	      }
 	  }
+	else
+	  {
+	    if (x == stack_pointer_rtx)
+	      {
+		*do_not_record_p = 1;
+		return 0;
+	      }
+	  }
 
 	hash += ((unsigned int) REG << 7);
         hash += (have_reg_qty ? (unsigned) REG_QTY (regno) : regno);


-- 


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


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

* [Bug rtl-optimization/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86 with gcse after reload
  2005-08-18  7:30 [Bug target/23453] New: [4.0 4.1 regression] miscompilation of PARI/GP on x86 debian-gcc at lists dot debian dot org
                   ` (6 preceding siblings ...)
  2005-08-19 19:51 ` belyshev at depni dot sinp dot msu dot ru
@ 2005-09-27 16:24 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:24 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

* [Bug rtl-optimization/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86 with gcse after reload
       [not found] <bug-23453-5724@http.gcc.gnu.org/bugzilla/>
  2005-10-14 11:38 ` bonzini at gcc dot gnu dot org
  2005-10-31  5:09 ` mmitchel at gcc dot gnu dot org
@ 2005-11-05 10:48 ` steven at gcc dot gnu dot org
  2 siblings, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-11-05 10:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from steven at gcc dot gnu dot org  2005-11-05 10:48 -------
This doesn't fail for me with the test case from comment #6...  :-(


-- 


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


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

* [Bug rtl-optimization/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86 with gcse after reload
       [not found] <bug-23453-5724@http.gcc.gnu.org/bugzilla/>
  2005-10-14 11:38 ` bonzini at gcc dot gnu dot org
@ 2005-10-31  5:09 ` mmitchel at gcc dot gnu dot org
  2005-11-05 10:48 ` steven at gcc dot gnu dot org
  2 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-31  5:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from mmitchel at gcc dot gnu dot org  2005-10-31 05:09 -------
Leaving as P2.


-- 


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


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

* [Bug rtl-optimization/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86 with gcse after reload
       [not found] <bug-23453-5724@http.gcc.gnu.org/bugzilla/>
@ 2005-10-14 11:38 ` bonzini at gcc dot gnu dot org
  2005-10-31  5:09 ` mmitchel at gcc dot gnu dot org
  2005-11-05 10:48 ` steven at gcc dot gnu dot org
  2 siblings, 0 replies; 12+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-10-14 11:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from bonzini at gcc dot gnu dot org  2005-10-14 11:38 -------
> gcse after reload may move loads from stack around stack pointer changes. here
> is simple workaround, it is supposed to prevent gcse after reload from touching
> expressions containing stack pointer at all.

Off the top of my head, if GCSE-after-reload is designed to remove redundant
spills, will it do *anything* with your patch?


-- 


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


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

end of thread, other threads:[~2005-11-05 10:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-18  7:30 [Bug target/23453] New: [4.0 4.1 regression] miscompilation of PARI/GP on x86 debian-gcc at lists dot debian dot org
2005-08-18  7:36 ` [Bug target/23453] [4.0/4.1 " debian-gcc at lists dot debian dot org
2005-08-18  7:42 ` debian-gcc at lists dot debian dot org
2005-08-18 12:15 ` pinskia at gcc dot gnu dot org
2005-08-18 13:44 ` debian-gcc at lists dot debian dot org
2005-08-18 21:41 ` [Bug rtl-optimization/23453] " belyshev at depni dot sinp dot msu dot ru
2005-08-19  1:09 ` [Bug rtl-optimization/23453] [4.0/4.1 regression] miscompilation of PARI/GP on x86 with gcse after reload belyshev at depni dot sinp dot msu dot ru
2005-08-19 19:51 ` belyshev at depni dot sinp dot msu dot ru
2005-09-27 16:24 ` mmitchel at gcc dot gnu dot org
     [not found] <bug-23453-5724@http.gcc.gnu.org/bugzilla/>
2005-10-14 11:38 ` bonzini at gcc dot gnu dot org
2005-10-31  5:09 ` mmitchel at gcc dot gnu dot org
2005-11-05 10:48 ` steven 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).