From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 28 Dec 2018 11:24:25 +0300 From: Vladimir Davydov Subject: Re: [PATCH] cmake: workaround GCC 7.2 segfault on v?sn?printf Message-ID: <20181228082425.vfv6gpuntbgoxaes@esperanza> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: To: Alexander Turenko Cc: tarantool-patches@freelists.org List-ID: On Fri, Dec 28, 2018 at 07:48:54AM +0300, Alexander Turenko wrote: > GCC 7.2.1 fails like so on our codebase: > > /tarantool/src/lib/json/json.c: In function ‘json_token_snprint’: > /tarantool/src/lib/json/json.c:324:1: internal compiler error: Segmentation fault > json_token_snprint(char *buf, int size, const struct json_token *token, > ^~~~~~~~~~~~~~~~~~ > > The backtrace of cc1 is the following (failed to install compatible > debuginfo on Fedora 26, so ??s): > > #0 0x0000000000d0320c in get_source_location_for_substring(cpp_reader*, string_concat_db*, unsigned int, cpp_ttype, int, int, int, unsigned int*) () > #1 0x00000000005c0e79 in c_get_substring_location(substring_loc const&, unsigned int*) () > #2 0x00000000007f8418 in format_warning_va(substring_loc const&, source_range const*, char const*, int, char const*, __va_list_tag (*) [1]) () > #3 0x00000000007f838b in format_warning_at_substring(substring_loc const&, source_range const*, char const*, int, char const*, ...) () > #4 0x0000000000c72c2d in ?? () > #5 0x0000000000f6f308 in execute_one_pass(opt_pass*) () > #6 0x0000000000787da6 in ?? () > #7 0x00000000012ac338 in symbol_table::compile() () > #8 0x0000000000de650f in symbol_table::finalize_compilation_unit() () > #9 0x00000000012ee8df in ?? () > #10 0x0000000000d3ba84 in toplev::main(int, char**) () > #11 0x0000000000d3d35b in main () > > The issue in the GCC bugtracker: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83448 > > The idea of the commit is to check builtin snprintf with the code from > GCC test suite and disable all related builtins if the compiler is GCC > and the case fails. > > We also need to disable FORTIFY_SOURCES in the case, because it uses > v?sn?printf builtins directly. Frankly, I don't think it's worth adding a workaround for a buggy compiler version that's only used by distributions that passed EOL. IMO we'd better disable compilation for those distributions.