[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] UBSAN flags
From: |
Greg Chicares |
Subject: |
Re: [lmi] UBSAN flags |
Date: |
Sat, 4 Jun 2022 00:26:14 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 |
On 6/3/22 21:23, Vadim Zeitlin wrote:
> On Fri, 3 Jun 2022 19:51:19 +0000 Greg Chicares <gchicares@sbcglobal.net>
> wrote:
>
> GC> On 6/3/22 17:47, Vadim Zeitlin wrote:
> GC> > On Fri, 3 Jun 2022 16:29:18 +0000 Greg Chicares
> <gchicares@sbcglobal.net> wrote:
> [...]
> GC> > GC> My first question is whether you ever got 'i7702.cpp' to finish
> GC> > GC> compiling. It's gone for many minutes here already, even with
> GC> > GC> the second (not '#'-commented) set of flags above.
> GC> >
> GC> > I didn't have any problem with this or any other file, but I didn't use
> GC> > -fno-sanitize-recover=all because by the time I learnt about it, I had
> GC> > already built everything without it and I didn't want to rebuild again.
> GC>
> GC> What optimize option did you use? I used '-O3', and perhaps that's
> GC> my problem. I'll try again with '-O0' or perhaps '-Og'.
>
> I didn't use any optimization flags at all, i.e. the equivalent of "-O0",
> but "-Og" would be a better choice. I think UBSAN documentation recommends
> using at least "-O1" as the performance of the generated code is too poor
> otherwise, but at least for running the lmi unit tests "-O0" is good
> enough.
This attempt to compile only 'i7702.cpp' didn't look like
it would succeed, so I Ctrl-C'd it after 78 minutes.
Here's the command I used, but of course I've customized
the makefile...
/opt/lmi/src/lmi[0]$time make $coefficiency unit_tests
unit_test_targets=i7702_test build_type=ubsan 2>&1 |less -S
make $coefficiency unit_tests unit_test_targets=i7702_test build_type=ubsan 2
0.43s user 0.16s system 0% cpu 1:18:09.69 total
less -S 0.01s user 0.00s system 0% cpu 1:20:10.86 total
...so let me post the full command (everything that was
in the 'less' session started above):
g++ -MMD -MP -MT i7702.o -MF i7702.d -c -I /opt/lmi/src/lmi -I
/opt/lmi/src/lmi/tools/pete-2.1.1 -isystem
/opt/lmi/local/gcc_x86_64-pc-linux-gnu/lib/wx/include/gtk3-unicode-3.1 -isystem
/opt/lmi/local/include/wx-3.1 -isystem /opt/lmi/third_party/include -isystem
/opt/lmi/local/include -isystem /opt/lmi/local/include/libxml2
-DLMI_WX_NEW_USE_SO -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__
-D_FILE_OFFSET_BITS=64 -fno-ms-extensions -frounding-math -std=c++20
-pedantic-errors -Werror -Wall -Walloc-zero -Walloca -Wcast-align
-Wcast-function-type -Wconversion -Wdangling-else -Wdeprecated-declarations
-Wdisabled-optimization -Wdouble-promotion -Wduplicated-branches
-Wduplicated-cond -Wextra -Wformat-nonliteral -Wformat-security
-Wformat-signedness -Wformat-y2k -Wimport -Winvalid-pch -Wlogical-op
-Wmissing-include-dirs -Wmultichar -Wnull-dereference -Wpacked -Wpointer-arith
-Wredundant-decls -Wrestrict -Wshadow -Wsign-compare -Wstack-protector
-Wswitch-enum -Wtrampolines -Wundef -Wunreachable-code -Wunused-macros
-Wvector-operation-performance -Wno-parentheses -Wc++11-compat -Wc++14-compat
-Wc++1z-compat -Wcatch-value=3 -Wconditionally-supported -Wctor-dtor-privacy
-Wdelete-non-virtual-dtor -Wdeprecated -Wextra-semi -Wnoexcept -Wnoexcept-type
-Wnon-template-friend -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual
-Wplacement-new=2 -Wpmf-conversions -Wregister -Wreorder -Wstrict-null-sentinel
-Wsuggest-override -Wsynth -Wuseless-cast -Wzero-as-null-pointer-constant
-Wcast-qual -Wredundant-tags -Wvolatile -O0 -fno-omit-frame-pointer -ggdb
-fsanitize=undefined -fno-var-tracking-assignments -fPIC
/opt/lmi/src/lmi/i7702.cpp -oi7702.o
make[2]: *** [/opt/lmi/src/lmi/workhorse.make:925: i7702.o] Interrupt
make[1]: [/opt/lmi/src/lmi/workhorse.make:1281: unit_tests] Interrupt (ignored)
make: *** [GNUmakefile:240: /opt/lmi/gcc_x86_64-pc-linux-gnu/build/ubsan]
Interrupt
Other information:
/opt/lmi/src/lmi[0]$echo $LMI_TRIPLET
x86_64-pc-linux-gnu
/opt/lmi/src/lmi[0]$gcc -dumpfullversion
11.2.0
The relevant parts seem to be:
-O0: it worked for you
-fno-omit-frame-pointer: so that UBSAN can give useful reports
-fsanitize=undefined: sine qua non
-fno-var-tracking-assignments: I hoped that would make it faster
I could also try
-fno-sanitize-recover=all
but, as said above, UBSAN worked for you without it.
Am I missing something obvious?
- Re: [lmi] Unit tests hygiene, Greg Chicares, 2022/06/03
- Re: [lmi] Unit tests hygiene, Vadim Zeitlin, 2022/06/03
- [lmi] UBSAN flags [Was: Unit tests hygiene], Greg Chicares, 2022/06/03
- Re: [lmi] UBSAN flags, Vadim Zeitlin, 2022/06/03
- Re: [lmi] UBSAN flags,
Greg Chicares <=
- Re: [lmi] UBSAN flags, Vadim Zeitlin, 2022/06/04
- Re: [lmi] UBSAN flags, Greg Chicares, 2022/06/04
- Re: [lmi] UBSAN flags, Greg Chicares, 2022/06/06
- Re: [lmi] UBSAN flags, Vadim Zeitlin, 2022/06/06
- Re: [lmi] UBSAN flags, Greg Chicares, 2022/06/06
- Re: [lmi] UBSAN flags, Vadim Zeitlin, 2022/06/06
- Re: [lmi] UBSAN flags, Greg Chicares, 2022/06/07