Bug 109852 - Making of gcc13 errors out compiling libcpp/charset.cc with Wstringop-overflow Error with "-march=native -O3 "
Summary: Making of gcc13 errors out compiling libcpp/charset.cc with Wstringop-overflo...
Status: WAITING
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 13.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build, diagnostic
Depends on:
Blocks: Wstringop-overflow
  Show dependency treegraph
 
Reported: 2023-05-14 10:01 UTC by Erich
Modified: 2023-05-15 15:44 UTC (History)
1 user (show)

See Also:
Host:
Target: x86_64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2023-05-14 00:00:00


Attachments
Compressed preprocessed charset.i file (369.21 KB, application/gzip)
2023-05-15 15:33 UTC, Erich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erich 2023-05-14 10:01:03 UTC
After 
git pull
make
configure:
configure --prefix=/home/xxxx/software/gccinstall --disable-multilib
Processor
Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
uname -a 
Linux fedora 6.2.13-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 26 20:15:56 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
 
the production of gcc stoped after errors:
ehome/xxxx/software/gcc13/host-x86_64-pc-linux-gnu/prev-gcc/xg++ -B/home/xxxx/software/gcc13/host-x86_64-pc-linux-gnu/prev-gcc/ -B/home/xxxx/software/gcccinstall/x86_64-pc-linux-gnu/bin/ -nostdinc++ -B/home/xxxx/software/gcc13/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -B/home/xxxx/software/gcc13/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/home/xxxx/software/gcc13/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu  -I/home/xxxx/software/gcc13/prev-x86_64-pc-linux-gnu/libstdc++-v3/include  -I/home/xxxx/software/gcc13/libstdc++-v3/libsupc++ -L/home/xxxx/software/gcc13/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/home/xxxx/software/gcc13/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs  -I../.././libcpp -I. -I../.././libcpp/../include -I../.././libcpp/include -march=native -O3 -Wall -Wextra  -g -O2 -fno-checking -gtoggle -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic -Wno-long-long -Werror -fno-exceptions -fno-rtti -I../.././libcpp -I. -I../.././libcpp/../include -I../.././libcpp/include -march=native -O3 -Wall -Wextra    -c -o charset.o -MT charset.o -MMD -MP -MF .deps/charset.Tpo ../.././libcpp/charset.cc
In function ‘int one_cppchar_to_utf8(cppchar_t, uchar**, size_t*)’,
    inlined from ‘const uchar* convert_ucn(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, source_range, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:1764:30,
    inlined from ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:2175:26:
../.././libcpp/charset.cc:255:15: error: writing 16 bytes into a region of size 6 [-Werror=stringop-overflow=]
  255 |     *outbuf++ = *p++;
      |     ~~~~~~~~~~^~~~~~
../.././libcpp/charset.cc: In function ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’:
../.././libcpp/charset.cc:1747:9: note: at offset [3, 6] into destination object ‘buf’ of size 6
../.././libcpp/charset.cc:1747:9: note: at offset 35 into destination object ‘buf’ of size 6
In function ‘int one_cppchar_to_utf8(cppchar_t, uchar**, size_t*)’,
    inlined from ‘const uchar* convert_ucn(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, source_range, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:1764:30,
    inlined from ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:2175:26:
../.././libcpp/charset.cc:255:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  255 |     *outbuf++ = *p++;
      |     ~~~~~~~~~~^~~~~~
../.././libcpp/charset.cc: In function ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’:
../.././libcpp/charset.cc:1747:9: note: at offset 36 into destination object ‘buf’ of size 6
 1747 |   uchar buf[6];
      |         ^~~
../.././libcpp/charset.cc:1747:9: note: at offset [4, 6] into destination object ‘buf’ of size 6
../.././libcpp/charset.cc:1747:9: note: at offset 36 into destination object ‘buf’ of size 6
In function ‘int one_cppchar_to_utf8(cppchar_t, uchar**, size_t*)’,
    inlined from ‘const uchar* convert_ucn(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, source_range, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:1764:30,
    inlined from ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:2175:26:
../.././libcpp/charset.cc:255:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  255 |     *outbuf++ = *p++;
      |     ~~~~~~~~~~^~~~~~
../.././libcpp/charset.cc: In function ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’:
../.././libcpp/charset.cc:1747:9: note: at offset 37 into destination object ‘buf’ of size 6
 1747 |   uchar buf[6];
      |         ^~~
../.././libcpp/charset.cc:1747:9: note: at offset [5, 6] into destination object ‘buf’ of size 6
../.././libcpp/charset.cc:1747:9: note: at offset 37 into destination object ‘buf’ of size 6
In function ‘int one_cppchar_to_utf8(cppchar_t, uchar**, size_t*)’,
    inlined from ‘const uchar* convert_ucn(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, source_range, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:1764:30,
    inlined from ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:2175:26:
../.././libcpp/charset.cc:255:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  255 |     *outbuf++ = *p++;
      |     ~~~~~~~~~~^~~~~~
../.././libcpp/charset.cc: In function ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’:
../.././libcpp/charset.cc:1747:9: note: at offset 38 into destination object ‘buf’ of size 6
 1747 |   uchar buf[6];
      |         ^~~
../.././libcpp/charset.cc:1747:9: note: at offset 6 into destination object ‘buf’ of size 6
../.././libcpp/charset.cc:1747:9: note: at offset 38 into destination object ‘buf’ of size 6
In function ‘int one_cppchar_to_utf8(cppchar_t, uchar**, size_t*)’,
    inlined from ‘const uchar* convert_ucn(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, source_range, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:1764:30,
    inlined from ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:2175:26:
../.././libcpp/charset.cc:255:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  255 |     *outbuf++ = *p++;
      |     ~~~~~~~~~~^~~~~~
../.././libcpp/charset.cc: In function ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’:
../.././libcpp/charset.cc:1747:9: note: at offset 39 into destination object ‘buf’     |         ^~~
 1747 |   uchar buf[6];
      |         ^~~
../.././libcpp/charset.cc:1747:9: note: at offset [8, 24] into destination object ‘buf’ of size 6
../.././libcpp/charset.cc:1747:9: note: at offset 40 into destination object ‘buf’ of size 6
In function ‘int one_cppchar_to_utf8(cppchar_t, uchar**, size_t*)’,
    inlined from ‘const uchar* convert_ucn(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, source_range, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:1764:30,
    inlined from ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:2175:26:
../.././libcpp/charset.cc:255:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  255 |     *outbuf++ = *p++;
      |     ~~~~~~~~~~^~~~~~
../.././libcpp/charset.cc: In function ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’:
../.././libcpp/charset.cc:1747:9: note: at offset 41 into destination object ‘buf’ of size 6
 1747 |   uchar buf[6];
      |         ^~~
../.././libcpp/charset.cc:1747:9: note: at offset [9, 25] into destination object ‘buf’ of size 6
../.././libcpp/charset.cc:1747:9: note: at offset 41 into destination object ‘buf’ of size 6
In function ‘int one_cppchar_to_utf8(cppchar_t, uchar**, size_t*)’,
    inlined from ‘const uchar* convert_ucn(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, source_range, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:1764:30,
    inlined from ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:2175:26:
../.././libcpp/charset.cc:255:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  255 |     *outbuf++ = *p++;
      |     ~~~~~~~~~~^~~~~~
../.././libcpp/charset.cc: In function ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’:
../.././libcpp/charset.cc:1747:9: note: at offset 42 into destination object ‘buf’ of size 6
 1747 |   uchar buf[6];
      |         ^~~
../.././libcpp/charset.cc:1747:9: note: at offset [10, 26] into destination object ‘buf’ of size 6
../.././libcpp/charset.cc:1747:9: note: at offset 42 into destination object ‘buf’ of size 6
In function ‘int one_cppchar_to_utf8(cppchar_t, uchar**, size_t*)’,
    inlined from ‘const uchar* convert_ucn(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, source_range, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:1764:30,
    inlined from ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:2175:26:
../.././libcpp/charset.cc:255:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  255 |     *outbuf++ = *p++;
      |     ~~~~~~~~~~^~~~~~
../.././libcpp/charset.cc: In function ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’:
../.././libcpp/charset.cc:1747:9: note: at offset 43 into destination object ‘buf’ of size 6
 1747 |   uchar buf[6];
      |         ^~~
../.././libcpp/charset.cc:1747:9: note: at offset [11, 27] into destination object ‘buf’ of size 6
../.././libcpp/charset.cc:1747:9: note: at offset 43 into destination object ‘buf’ of size 6
In function ‘int one_cppchar_to_utf8(cppchar_t, uchar**, size_t*)’,
    inlined from ‘const uchar* convert_ucn(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, source_range, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:1764:30,
    inlined from ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:2175:26:
../.././libcpp/charset.cc:255:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  255 |     *outbuf++ = *p++;
      |     ~~~~~~~~~~^~~~~~
../.././libcpp/charset.cc: In function ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’:
../.././libcpp/charset.cc:1747:9: note: at offset 44 into destination object ‘buf’ of size 6
 1747 |   uchar buf[6];
      |         ^~~
../.././libcpp/charset.cc:1747:9: note: at offset [12, 28] into destination object ‘buf’ of size 6
../.././libcpp/charset.cc:1747:9: note: at offset 44 into destination object ‘buf’ of size 6
In function ‘int one_cppchar_to_utf8(cppchar_t, uchar**, size_t*)’,
    inlined from ‘const uchar* convert_ucn(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, source_range, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:1764:30,
    inlined from ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:2175:26:
../.././libcpp/charset.cc:255:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  255 |     *outbuf++ = *p++;
      |     ~~~~~~~~~~^~~~~~
../.././libcpp/charset.cc: In function ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’:
../.././libcpp/charset.cc:1747:9: note: at offset 45 into destination object ‘buf’ of size 6
 1747 |   uchar buf[6];
      |         ^~~
../.././libcpp/charset.cc:1747:9: note: at offset [13, 29] into destination object ‘buf’ of size 6
../.././libcpp/charset.cc:1747:9: note: at offset 45 into destination object ‘buf’ of size 6
In function ‘int one_cppchar_to_utf8(cppchar_t, uchar**, size_t*)’,
    inlined from ‘const uchar* convert_ucn(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, source_range, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:1764:30,
    inlined from ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’ at ../.././libcpp/charset.cc:2175:26:
../.././libcpp/charset.cc:255:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  255 |     *outbuf++ = *p++;
      |     ~~~~~~~~~~^~~~~~
../.././libcpp/charset.cc: In function ‘const uchar* convert_escape(cpp_reader*, const uchar*, const uchar*, _cpp_strbuf*, cset_converter, cpp_string_location_reader*, cpp_substring_ranges*)’:
../.././libcpp/charset.cc:1747:9: note: at offset 46 into destination object ‘buf’ of size 6
 1747 |   uchar buf[6];
      |         ^~~
../.././libcpp/charset.cc:1747:9: note: at offset [14, 30] into destination object ‘buf’ of size 6
../.././libcpp/charset.cc:1747:9: note: at offset 46 into destination object ‘buf’ of size 6
cc1plus: all warnings being treated as errors
make[3]: *** [Makefile:227: charset.o] Fehler 1
make[3]: Verzeichnis
make end in stage2 with errors
Some more messages where produced with nearly the same text
Comment 1 Andrew Pinski 2023-05-14 14:13:04 UTC
You must have CXXFLAGS set to be "-march=native -O3 ". If so you should be using --disable-werror too.

Can you attach the preprocessed source for charset.cc ?
Also Please provide the output with -v while compiling charset.cc since -march=native will expand to something different depending on what machine you run gcc on.
Comment 2 Andrew Pinski 2023-05-14 18:53:29 UTC
I cannot reproduce this with "../configure --with-build-config=bootstrap-O3" .
Comment 3 Xi Ruoyao 2023-05-15 06:10:00 UTC
AFAIK building any package (not only GCC) with `--enable-werror` and some random CFLAGS is not supported.
Comment 4 Erich 2023-05-15 15:33:37 UTC
Created attachment 55086 [details]
Compressed preprocessed charset.i file
Comment 5 Erich 2023-05-15 15:44:17 UTC
The output of -v ->
Lesen der Spezifikationen von /home/xxxx/software/gcc13/host-x86_64-pc-linux-gnu/prev-gcc/specs
COLLECT_GCC=/home/xxxx/software/gcc13/host-x86_64-pc-linux-gnu/prev-gcc/xg++
Ziel: x86_64-pc-linux-gnu
Konfiguriert mit: configure --disable-multilib --prefix=/home/xxxx/software/gccinstall
Thread-Modell: posix
Unterstützte LTO-Kompressionsalgorithmen: zlib zstd
gcc-Version 14.0.0 20230514 (experimental) (GCC)