+2013-11-08 Balaji V.
+2013-11-08 Balaji V. Iyer <balaji.v.iyer@intel.com> + + PR c/59039 + * runtime/cilk_fiber-unix.cpp: Fixed a crash in run() function + when optimization is turned on. + From-SVN: r204592
This commit is contained in:
parent
3361dd3a6d
commit
d53b3432e2
@ -1,3 +1,9 @@
|
|||||||
|
2013-11-08 Balaji V. Iyer <balaji.v.iyer@intel.com>
|
||||||
|
|
||||||
|
PR c/59039
|
||||||
|
* runtime/cilk_fiber-unix.cpp: Fixed a crash in run() function
|
||||||
|
when optimization is turned on.
|
||||||
|
|
||||||
2013-11-04 Balaji V. Iyer <balaji.v.iyer@intel.com>
|
2013-11-04 Balaji V. Iyer <balaji.v.iyer@intel.com>
|
||||||
|
|
||||||
PR bootstrap/58951
|
PR bootstrap/58951
|
||||||
|
@ -44,24 +44,27 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#if defined HAVE_ALLOCA_H
|
|
||||||
# include <alloca.h>
|
|
||||||
#elif defined __GNUC__
|
|
||||||
# define alloca __builtin_alloca
|
|
||||||
#elif defined _AIX
|
|
||||||
# define alloca __alloca
|
|
||||||
#else
|
|
||||||
# include <stddef.h>
|
|
||||||
# ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
# endif
|
|
||||||
void *alloca (size_t);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
// You'd think that getting a defintion for alloca would be easy. But you'd
|
||||||
|
// be wrong. Here's a variant on what's recommended in the autoconf doc. I've
|
||||||
|
// remove the Windows portion since this is Unix-specific code.
|
||||||
|
#if defined HAVE_ALLOCA_H
|
||||||
|
# include <alloca.h>
|
||||||
|
#elif defined __GNUC__
|
||||||
|
# define alloca __builtin_alloca
|
||||||
|
#elif defined _AIX
|
||||||
|
# define alloca __alloca
|
||||||
|
#else
|
||||||
|
# include <stddef.h>
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
void *alloca (size_t);
|
||||||
|
#endif
|
||||||
|
|
||||||
// MAP_ANON is deprecated on Linux, but seems to be required on Mac...
|
// MAP_ANON is deprecated on Linux, but seems to be required on Mac...
|
||||||
#ifndef MAP_ANONYMOUS
|
#ifndef MAP_ANONYMOUS
|
||||||
#define MAP_ANONYMOUS MAP_ANON
|
#define MAP_ANONYMOUS MAP_ANON
|
||||||
@ -163,8 +166,15 @@ NORETURN cilk_fiber_sysdep::jump_to_resume_other_sysdep(cilk_fiber_sysdep* other
|
|||||||
__cilkrts_bug("Should not get here");
|
__cilkrts_bug("Should not get here");
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma GCC push_options
|
// GCC doesn't allow us to call __builtin_longjmp in the same function that
|
||||||
#pragma GCC optimize ("-O0")
|
// calls __builtin_setjmp, so create a new function to house the call to
|
||||||
|
// __builtin_longjmp
|
||||||
|
static void __attribute__((noinline))
|
||||||
|
do_cilk_longjmp(__CILK_JUMP_BUFFER jmpbuf)
|
||||||
|
{
|
||||||
|
CILK_LONGJMP(jmpbuf);
|
||||||
|
}
|
||||||
|
|
||||||
NORETURN cilk_fiber_sysdep::run()
|
NORETURN cilk_fiber_sysdep::run()
|
||||||
{
|
{
|
||||||
// Only fibers created from a pool have a proc method to run and execute.
|
// Only fibers created from a pool have a proc method to run and execute.
|
||||||
@ -201,7 +211,11 @@ NORETURN cilk_fiber_sysdep::run()
|
|||||||
// switching to for any temporaries required for this run()
|
// switching to for any temporaries required for this run()
|
||||||
// function.
|
// function.
|
||||||
JMPBUF_SP(m_resume_jmpbuf) = m_stack_base - frame_size;
|
JMPBUF_SP(m_resume_jmpbuf) = m_stack_base - frame_size;
|
||||||
CILK_LONGJMP(m_resume_jmpbuf);
|
|
||||||
|
// GCC doesn't allow us to call __builtin_longjmp in the same function
|
||||||
|
// that calls __builtin_setjmp, so it's been moved into it's own
|
||||||
|
// function that cannot be inlined.
|
||||||
|
do_cilk_longjmp(m_resume_jmpbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: our resetting of the stack pointer is valid only if the
|
// Note: our resetting of the stack pointer is valid only if the
|
||||||
@ -228,7 +242,6 @@ NORETURN cilk_fiber_sysdep::run()
|
|||||||
// User proc should never return.
|
// User proc should never return.
|
||||||
__cilkrts_bug("Should not get here");
|
__cilkrts_bug("Should not get here");
|
||||||
}
|
}
|
||||||
#pragma GCC pop_options
|
|
||||||
|
|
||||||
void cilk_fiber_sysdep::make_stack(size_t stack_size)
|
void cilk_fiber_sysdep::make_stack(size_t stack_size)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user