Description of problem: Building xtl on aarch64 [1] fails because of some kind of issue with gcc's handling of -march=native; there seems to be a buffer overflow. Version-Release number of selected component (if applicable): 9.0.0-0.4.fc30.aarch64 Actual results: /usr/bin/c++ -DHAVE_NLOHMANN_JSON -I/builddir/build/BUILD/xtl-0.5.3/include -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -DNDEBUG -Wunused-parameter -Wextra -Wreorder -Wconversion -Wsign-conversion -march=native -std=gnu++14 -o CMakeFiles/test_xcomplex_sequence.dir/test_xcomplex_sequence.cpp.o -c /builddir/build/BUILD/xtl-0.5.3/test/test_xcomplex_sequence.cpp BUILDSTDERR: Assembler messages: BUILDSTDERR: Error: unknown architecture `armv8-a�^&' BUILDSTDERR: Error: unrecognized option -march=armv8-a�^& BUILDSTDERR: cc1plus: error: unknown value 'armv8-\xf0^\x17' for -march BUILDSTDERR: cc1plus: note: valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a native; did you mean 'armv8-a'? Expected results: Should compile. Additional info: [1] https://koji.fedoraproject.org/koji/taskinfo?taskID=32203946
Will try to have a look if I manage to reproduce, for these issues one needs the same CPU... Anyway, using -march=native in the distro is an extremely bad idea, native is when you want to optimize and target your own CPU. We have different builders in koji, and then different sets of CPUs we do support as the distro, so if the code depends on whatever builder was choosen and will not run on earlier CPUs or will not be optimized for earlier CPUs, it is a major bug.
It's a header-only library and this is just building tests, so I don't really care about native build in the package. For this package, there's also something broken with the string code tests on ppc64le and armv7hl [1]. It doesn't occur on Fedora 29 [2]. I'm not yet sure if it's a bug related to this buffer overflow or something wrong in the package itself. [1] https://koji.fedoraproject.org/koji/taskinfo?taskID=32203917 [2] https://koji.fedoraproject.org/koji/buildinfo?buildID=1181587
(In reply to Elliott Sales de Andrade from comment #2) > It's a header-only library and this is just building tests, so I don't > really care about native build in the package. Why bother using -march=native at all then?
I haven't tried to reproduce on actual hardware, but this code in driver-aarch64.c looks suspicious to me: 351 ext_string 352 = aarch64_get_extension_string_for_isa_flags (extension_flags, 353 default_flags).c_str (); 354 355 res = concat (res, ext_string, NULL); as presumably the underlying std::string returned by aarch64_get_extension_string_for_isa_flags only lives until after the call to c_str, and thus is destroyed, and so the buffer pointed to by const char *ext_string has become invalid at line 355.
Yeah. So { std::string extension = aarch64_get_extension_string_for_isa_flags (extension_flags, default_flags); res = concat (res, extension.c_str (), NULL); } ? Anyway, David, can you please file an upstream PR, attach your patch for it there and submit?
Reproduced and filed upstream as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89014
I've posted a patch upstream: https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01381.html though note that it appears to also need: https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01302.html Reassigning this downstream bug.
Should be fixed in rawhide.
(In reply to Jonathan Wakely from comment #3) > (In reply to Elliott Sales de Andrade from comment #2) > > It's a header-only library and this is just building tests, so I don't > > really care about native build in the package. > > Why bother using -march=native at all then? Because it's in upstream and there's been no reason to patch it. And for the record, the tests still fail on Rawhide, but not 28/29, even without -march=native: https://koji.fedoraproject.org/koji/taskinfo?taskID=32773832