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

            Bug ID: 90058
           Summary: False Positive in undefined-sanitizer only with GCC8
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: svenja.mehringer at gmail dot com
  Target Milestone: ---

Created attachment 46148
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46148&action=edit
intermediate cpp file

Hi,

When compiling with the undefined-sanitizer I get an uninitialized warning with
GCC8 but not with GCC7 on the same intermediate file.

I created the intermediate file with GCC-7.4.0 (flags: -fsanitize=undefined
-fdiagnostics-color=always -O3 -DNDEBUG   -pedantic -Wall -Wextra -Werror
-std=c++17 -fconcepts -save-temps)

Then when compiling the following (GCC-8.2.0)

g++-8 -O3 -Wall -fsanitize=undefined -std=c++17 -fconcepts -pthread -o
format_sam_test-gcc8 format_sam_test.ii
gtest_project/src/gtest_project-build/googletest/libgtest.a
gtest_project/src/gtest_project-build/googletest/libgtest_main.a

this fails with 

```
In file included from
/srv/public/smehringer/seqan3/test/unit/io/alignment_file/format_sam_test.cpp:17:
/srv/public/smehringer/seqan3/include/seqan3/io/alignment_file/format_sam.hpp:
In lambda function:
/srv/public/smehringer/seqan3/include/seqan3/io/alignment_file/format_sam.hpp:635:58:
warning: ‘*((void*)&<anonymous> +12)’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
                 write_range(stream_it,
(header.ref_ids())[get<0>(mate).value()]);

```

but the exact same command compiles fine with GCC-7.4.0

I'm working on Linux:
Linux 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 GNU/Linux

Reply via email to