public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/41089]  New: [4.5 Regression] r147980 (New SRA) breaks stdargs
@ 2009-08-17 11:35 ubizjak at gmail dot com
  2010-07-31  9:33 ` [Bug tree-optimization/41089] [4.5/4.6 Regression] stdarg pass produces wrong code rguenth at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: ubizjak at gmail dot com @ 2009-08-17 11:35 UTC (permalink / raw)
  To: gcc-bugs

r147980 [1] breaks stdargs on alpha [2]:

FAIL: gcc.c-torture/execute/stdarg-1.c execution,  -O3 -fomit-frame-pointer 
FAIL: gcc.c-torture/execute/stdarg-1.c execution,  -O3 -g 
FAIL: gcc.c-torture/execute/stdarg-4.c execution,  -O1 
FAIL: gcc.c-torture/execute/stdarg-4.c execution,  -O2 
FAIL: gcc.c-torture/execute/stdarg-4.c execution,  -O3 -fomit-frame-pointer 
FAIL: gcc.c-torture/execute/stdarg-4.c execution,  -O3 -g 
FAIL: gcc.c-torture/execute/stdarg-4.c execution,  -Os 
...
FAIL: gcc.dg/tree-ssa/stdarg-2.c scan-tree-dump stdarg "f15: va_list escapes 1,
needs to save all GPR units and all FPR units"

Before new SRA, stdarg dump for gcc.dg/tree-ssa/stdarg-2.c, f15 () showed:

--cut here--
va_list escapes in # .MEMD.2039_12 = VDEF <.MEMD.2039_2>
apD.2040 = apD.1263;

f15: va_list escapes 1, needs to save all GPR units and all FPR units.
--cut here--

With new SRA (r147980):

bb2 will be executed at most once for each va_start in bb2
bb3 will be executed at most once for each va_start in bb2
f15: va_list escapes 0, needs to save 8 GPR units and 0 FPR units.

The last OK testresults were from r147610 [3] and started to fail in r148747
[4]

The problem can be triggered by compiling following test (distilled from
stdarg-2.c) with a crosscompiler to alpha-linux-gnu:

--cut here--
typedef __builtin_va_list __gnuc_va_list;
typedef __gnuc_va_list va_list;

long x;

inline void __attribute__((always_inline))
f15_1 (va_list ap)
{
  x = __builtin_va_arg(ap,long);
}

void
f15 (int i, ...)
{
  va_list ap;
  __builtin_va_start(ap,i);
  f15_1 (ap);
  __builtin_va_end(ap);
}
--cut here--

gcc -O2 -fdump-tree-stdarg.

Runtime failure will be triggered by following test (sorry for the debug
printk's):

--cut here--
# 1 "t.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "t.c"
# 1 "/space/uros/gcc-build-44/gcc/include/stdarg.h" 1 3 4
# 40 "/space/uros/gcc-build-44/gcc/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 102 "/space/uros/gcc-build-44/gcc/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 2 "t.c" 2

extern void abort (void);

int foo_arg;
long x;

void
foo (int v, va_list ap)
{
  printf ("__base = %p\n", ap.__base);
  printf ("__offset = %i\n", ap.__offset);
  switch (v)
    {
    case 5: foo_arg = __builtin_va_arg(ap,int);
    printf ("foo_arg = %i\n", foo_arg);
    break;
    default: abort ();
    }
  printf ("__base = %p\n", ap.__base);
  printf ("__offset = %i\n", ap.__offset);
}

void
__attribute__((noinline))
f4 (int i, ...)
{
  va_list ap;
  __builtin_va_start(ap,i);
  printf ("f4 __base = %p\n", ap.__base);
  printf ("f4 __offset = %i\n", ap.__offset);
  x = __builtin_va_arg(ap,double);


  foo (i, ap);

  printf ("f4 __base = %p\n", ap.__base);
  printf ("f4 __offset = %i\n", ap.__offset);
  __builtin_va_end(ap);
}

int
main (void)
{
f4 (5, 16.0, 128);
  if (x != 16 || foo_arg != 128)
    abort ();
return 0;
}
--cut here--

foo_arg will be 0 at the final test.

[1] http://gcc.gnu.org/ml/gcc-cvs/2009-05/msg00959.html

[2] http://gcc.gnu.org/ml/gcc-testresults/2009-08/msg01508.html
[3] http://gcc.gnu.org/ml/gcc-testresults/2009-05/msg01614.html
[4] http://gcc.gnu.org/ml/gcc-testresults/2009-06/msg01912.html


-- 
           Summary: [4.5 Regression] r147980 (New SRA) breaks stdargs
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ubizjak at gmail dot com
GCC target triplet: alphaev68-unknown-linux-gnu


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


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

end of thread, other threads:[~2015-05-05 10:40 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-41089-4@http.gcc.gnu.org/bugzilla/>
2010-12-16 13:26 ` [Bug tree-optimization/41089] [4.5/4.6 Regression] stdarg pass produces wrong code rguenth at gcc dot gnu.org
2011-04-28 16:20 ` [Bug tree-optimization/41089] [4.5/4.6/4.7 " rguenth at gcc dot gnu.org
2012-07-02 13:43 ` [Bug tree-optimization/41089] [4.6/4.7/4.8 " rguenth at gcc dot gnu.org
2013-04-12 15:18 ` [Bug tree-optimization/41089] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
2014-06-12 13:49 ` [Bug tree-optimization/41089] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:43 ` [Bug tree-optimization/41089] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-02-05 17:55 ` burnus at gcc dot gnu.org
2015-04-20  9:52 ` [Bug tree-optimization/41089] [4.8/4.9/5/6 " vries at gcc dot gnu.org
2015-04-20 10:09 ` ubizjak at gmail dot com
2015-04-21  6:24 ` ubizjak at gmail dot com
2015-04-21  6:59 ` [Bug target/41089] " ubizjak at gmail dot com
2015-05-04 13:10 ` ro at gcc dot gnu.org
2015-05-05 10:40 ` vries at gcc dot gnu.org
2009-08-17 11:35 [Bug tree-optimization/41089] New: [4.5 Regression] r147980 (New SRA) breaks stdargs ubizjak at gmail dot com
2010-07-31  9:33 ` [Bug tree-optimization/41089] [4.5/4.6 Regression] stdarg pass produces wrong code rguenth at gcc dot gnu dot org
2010-08-01 12:50 ` ubizjak at gmail dot com
2010-08-02 17:13 ` ubizjak at gmail dot com
2010-08-02 17:33 ` ubizjak at gmail dot com
2010-08-03 18:45 ` uros at gcc dot gnu dot org
2010-08-03 18:53 ` ubizjak at gmail dot com
2010-08-03 18:56 ` ubizjak at gmail dot com

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).