https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71104

--- Comment #17 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 14 Jul 2016, bernd.edlinger at hotmail dot de wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71104
> 
> --- Comment #16 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
> (In reply to rguent...@suse.de from comment #15)
> > On Thu, 14 Jul 2016, bernd.edlinger at hotmail dot de wrote:
> > 
> > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71104
> > > 
> > > --- Comment #14 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
> > > One question though...
> > > 
> > > This depends on a special knowledge about "vfork",
> > > but it seems that gcc does not honor -ffreestanding
> > > correctly in this case, because:
> > > 
> > > gcc -ffreestanding pr71104-1.c
> > > 
> > > should not have crashed (before your patch, but it did).
> > 
> > Even with -ffreestanding we handle some functions conservatively.
> > See special_function_p.
> 
> Oh, I see.
> Handling vfork that may be conservative, but longjmp is not conservative.

Yeah, returning ECF_NORETURN isn't conservative.  OTOH this code
only looking at the name of the function rather than using the
corresponding builtin pre-dates my GCC involvement.

Can you open a separate bug please?

> 
> test.c:
> 
> void foo(void);
> int longjmp(void);
> int *p;
> 
> void bar(void)
> {
>   foo();
>   *p = longjmp();
> }
> 
> gcc -Wall -S -O3 -ffreestanding test.c
> gives zero warning, and invalid code:
> 
> bar:
> .LFB0:
>         .cfi_startproc
>         subq    $8, %rsp
>         .cfi_def_cfa_offset 16
>         call    foo
>         call    longjmp
>         .cfi_endproc
> 
>

Reply via email to