[Bug tree-optimization/104356] [12 Regression] divide by zero trap is being removed now when it should not be in some cases

ebotcazou at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 3 12:18:02 GMT 2022


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

--- Comment #26 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Oh, with the little detail that it should be
> cfun->can_throw_non_call_exceptions
> (with the unfortunate reference to cfun)

Yes, and note that this will also solve the libgcc2.c issue because of:

ifeq ($(LIB2_DIVMOD_EXCEPTION_FLAGS),)
# Provide default flags for compiling divmod functions, if they haven't been
# set already by a target-specific Makefile fragment.
LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions -fnon-call-exceptions
endif

# Build LIB2_DIVMOD_FUNCS.
lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
$(lib2-divmod-o): %$(objext): $(srcdir)/libgcc2.c
        $(gcc_compile) -DL$* -c $< \
          $(LIB2_DIVMOD_EXCEPTION_FLAGS) $(vis_hide)
libgcc-objects += $(lib2-divmod-o)

ifeq ($(enable_shared),yes)
lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
$(lib2-divmod-s-o): %_s$(objext): $(srcdir)/libgcc2.c
        $(gcc_s_compile) -DL$* -c $< \
          $(LIB2_DIVMOD_EXCEPTION_FLAGS)
libgcc-s-objects += $(lib2-divmod-s-o)
endif

in libgcc/Makefile.in.


More information about the Gcc-bugs mailing list