This is the mail archive of the 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]

How to disable "noreturn" attribute propagation/handling?


On Tue, 20 May 2014 13:21:06 +0200, Tom de Vries <> wrote:
> On 17/05/14 17:53, Tom de Vries wrote:
> > On 16/05/14 22:28, Thomas Schwinge wrote:
> >> > It may make sense to have an abort function available in PTX land.

... which we've now had for a long time.  However, I recently noticed
that it doesn't actually behave as expected:
<> 'The nvptx
"abort" implementation doesn't actually abort execution #5'.  ;-| That
is, for the last year or so, the nvptx "abort" implementation silently
"exit"ed instead of "trap"ping.  However code such as:

> #pragma acc parallel
>   {
>     abort ();
>   }

... still caused process termination, and while I have not analyzed that
in detail, the reason seems to be along the lines that GCC propagates the
"abort"'s "noreturn" attribute to the OMP child function
("main._omp_fn.0"), and then places a "__builtin_unreachable" after the
"GOACC_parallel_keyed" -- which is the cause of the process termination.
(Quite surprising to me, that is done even for "-O0"!)  See

    Introduced new external node (__builtin_unreachable/8).
      GOACC_parallel_keyed (-1, main._omp_fn.0, 0, 0B, 0B, 0B, 0);
      __builtin_unreachable ();

Now, I could do something like:

     #pragma acc parallel
    -    abort ();
    +    int cond = 1;
    +    asm volatile ("" : : : "memory");
    +    if (cond)
    +      abort ();

... to prevent that from happening -- but isn't there a generic way
(command-line flag?) to disable the analysis that causes the "noreturn"
attribute propagation/handling?


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