jkmcnk / sx-gcc

The GNU Compiler Collection port to NEC SX CPU architecture.
GNU General Public License v2.0
0 stars 2 forks source link

powi - internal compiler error #43

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Test case dg.exp=pr19402-2.c fails with a crash when compiling.

Shortend testcase :
void abort(void);

long double powil(long double x, int n)
{
  return __builtin_powil(x, n);
}

int main()
{
  if (powil(1.0, -5) != 1.0)
    abort();
  return 0;
}

Where __builtin_powil(x, n); is the problem.
I suspect the problem is calling __builtin_powil with long double. 

The failure is :
*** glibc detected ***
/home/fred/dev/projects/sx/sx/libexec/gcc/sx8-nec-superux/4.2.2/cc1:
free(): invalid next size (fast): 0x0000000000d94a40 ***

Original issue reported on code.google.com by fred.tre...@googlemail.com on 29 Oct 2008 at 1:02

GoogleCodeExporter commented 8 years ago
The crash occurs in the file calls.c in the gcc directory. 

  if (stack_usage_map_buf) {
    free (stack_usage_map_buf);
  }

at the end of function : emit_library_call_value_1

The variable is set in the routine with :
#ifdef ARGS_GROW_DOWNWARD
      highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
                                         needed + 1);
#else
      highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
                                         needed);
#endif
      stack_usage_map_buf = XNEWVEC (char, highest_outgoing_arg_in_use);

The call comes from a higher level routine in builtins.c :
expand_builtin_powi

Original comment by fred.tre...@googlemail.com on 29 Oct 2008 at 2:42

GoogleCodeExporter commented 8 years ago
With the current version of sx-gcc, the test case above compiles and executes. 
The
same holds for the "pr19402-2.c" test case.

Fred, could you check if this issue also disappears for your sx-gcc 
configuration?

Original comment by nou...@gmail.com on 27 Nov 2008 at 10:19

GoogleCodeExporter commented 8 years ago
I still see this problem. For example in the last test results, running on 
the testmachine (clean svn). 

http://source.tree.se/sx/sx-gcc/testrun/142-180-180-sx-2.19/gcc.log

/home/fred/tmp/sx/src/sx-gcc/gcc/testsuite/gcc.dg/pr19402-2.c: In function 
'powicl':
/home/fred/tmp/sx/src/sx-gcc/gcc/testsuite/gcc.dg/pr19402-2.c:51: internal 
compiler
error: Aborted
...
** glibc detected *** /home/fred/tmp/sx/sx-build/gcc/cc1: free(): invalid next 
size
(fast): 0x0000000001f33430 ***

In what svn revision and testsetup did the failure disapear ?
Compiling on x86-64, running on sx6i. 

Original comment by fred.tre...@googlemail.com on 2 Dec 2008 at 10:33

GoogleCodeExporter commented 8 years ago
Funny thing, on my computer (i686), with the current release (r150) of sx-gcc, 
the
"pr19402-2.c" test case compiles just fine. The test also executes fine if I 
run it
on SX8.

So it must be the x86_64 issue...

Original comment by nou...@gmail.com on 2 Dec 2008 at 11:07

GoogleCodeExporter commented 8 years ago
what's the status of this, folks? imho it should have been fixed with current 
trunk
that includes all the fp magic we did since reported ... someone in the know, 
pls
check and resolve.

Original comment by jmoc...@gmail.com on 15 Jan 2009 at 12:31

GoogleCodeExporter commented 8 years ago
caused by buffer overflow in emit_library_call_value_1. this has been fixed in 
our
trunk since r225. patch also sent upstream.

Original comment by jmoc...@gmail.com on 6 Mar 2009 at 12:22