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

            Bug ID: 123873
           Summary: UBSAN confuses optimizer
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: peterz at infradead dot org
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
  Target Milestone: ---

Hi,

Some Linux kernel builds with GCC-15.2.0 fail optimizing in the face of UBSAN.

https://lore.kernel.org/all/[email protected]/

Is it considered acceptable for UBSAN to affect optimization quality like this?
I ask because various Distro's are shipping UBSAN=y kernels, and if it is
causing obvious optimization issues like this I'm going to have to tell them to
stop doing that.

The code in question is:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/seqlock.h#n1237

And compilers (clang and GCC) are generally capable of seeing right through all
that and generate tight code. Except with the various sanitizers on; then it
goes off the rails. I've already (as you can see) marked KASAN as 'special'
because nobody should care about performance on a KASAN=y build, but what about
UBSAN?

Do you compiler folks consider UBSAN something that should be viable for a
'release' build -- if so, its failing. If not, I'm going to have to dissuade
Debian and friends from having it enabled.

~ Peter

Reply via email to