This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/20802] [4.0] mmix-knuth-mmixware testsuite failure: gcc.dg/builtin-apply4.c execution



------- Comment #7 from rob1weld at aol dot com  2007-06-08 23:34 -------
I tried this on i686-pc-linux-gnu using gcc-3.4 (from Debian), gcc-4.1 (from
Debian), gcc version 4.2.0 20070501 (prerelease) (from SVN), and gcc version
4.3.0 20070607 (experimental) (from SVN):

I modified as follows:

/* PR tree-optimization/20076 */
/* { dg-options "-O2" } */
/* { dg-do run } */

extern void abort (void);

double
foo (int arg)
{
printf("foo1  - arg = %u \n", arg);
  if (arg != 116)
    abort();
printf("foo2  - arg = %u \n", arg);
  return arg + 1;
}

inline double
bar (int arg)
{
printf("bar1  - arg = %u \n", arg);
  foo (arg);
printf("bar2  - arg = %u \n", arg);
  __builtin_return (__builtin_apply ((void (*) ()) foo, __builtin_apply_args
(), 128));
  __builtin_return (__builtin_apply ((void (*) ()) foo, __builtin_apply_args
(), 32));
  __builtin_return (__builtin_apply ((void (*) ()) foo, __builtin_apply_args
(), 16));
printf("bar3  - arg = %u \n", arg);
}

int
main (int argc, char **argv)
{
printf("main1 - pre   bar\n");
  if (bar (116) != 117.0) {
printf("main2 - post  bar - abort\n");
    abort ();
  }
printf("main2 - post  bar - no abort\n");
  return 0;
}


The printf statments are the only changes, everything else is the same as
4.3.0.

Here is what the .exe's print for each version of gcc:

# ./builtin-apply4_gcc3.4.exe
main1 - pre   bar
bar1  - arg = 116 
foo1  - arg = 116 
foo2  - arg = 116 
bar2  - arg = 116 
foo1  - arg = 1 
Aborted

# ./builtin-apply4_gcc4.1.exe
main1 - pre   bar
bar1  - arg = 116 
foo1  - arg = 116 
foo2  - arg = 116 
bar2  - arg = 116 
foo1  - arg = 116 
foo2  - arg = 116 
main2 - post  bar - no abort

# ./builtin-apply4_gcc4.2.exe
main1 - pre   bar
bar1  - arg = 116 
foo1  - arg = 116 
foo2  - arg = 116 
bar2  - arg = 116 
foo1  - arg = 116 
foo2  - arg = 116 
main2 - post  bar - abort
Aborted

# ./builtin-apply4_4.3.exe
main1 - pre   bar
bar1  - arg = 116 
foo1  - arg = 116 
foo2  - arg = 116 
bar2  - arg = 116 
foo1  - arg = 116 
foo2  - arg = 116 
main2 - post  bar - abort
Aborted


GCC 3.4 prints "foo1  - arg = 1" - which is way off.

GCC 4.1 prints "main2 - post  bar - no abort" - which means it is OK

The others are incorrect. I do not have 4.0.0 to confirm this report but you
might says it was fixed in 4.1 - only to re-occur in later versions :( .

I'd change the known to fail field but I don't have permission.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]