[Bug c++/89579] New: -Wclobbered warning false positive when compiling with -Og
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89579 Bug ID: 89579 Summary: -Wclobbered warning false positive when compiling with -Og Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: diagnostic, rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: abigail.buccaneer at gmail dot com Target Milestone: --- Created attachment 45884 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45884=edit Minimal reproduction When compiling with `-Wclobbered -Og`, we see false positives from the -Wclobbered warning. These don't occur with any other optimization level. This breaks our build under `-Wextra -Werror -Og`. Attached is a minimal reproduction test case. This bug is present from GCC 5.5.0 to GCC trunk (9.0.1 20190303). GCC 5.4.0 and below are not affected.
[Bug c++/85049] Internal compiler error with __integer_pack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85049 --- Comment #1 from AbigailBuccaneer --- If `index_sequence_for` is replaced with `std::index_sequence_for` (and `#include ` is added), this code compiles fine under g++-7, but not g++-8 (where std::index_sequence_for is implemented in terms of __index_pack, similar to how it is in the code snippet above).
[Bug c++/85049] New: Internal compiler error with __integer_pack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85049 Bug ID: 85049 Summary: Internal compiler error with __integer_pack Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: abigail.buccaneer at gmail dot com Target Milestone: --- The following code: template struct index_sequence {}; template using index_sequence_for = index_sequence<__integer_pack(sizeof...(Ts))...>; template struct tuple {}; template int get(tuple<index_sequence_for, Ts...>); int x = get(tuple<index_sequence_for<>>{}); fails to compile with an internal compiler error. On gcc.godbolt.org's "gcc trunk" compiler, the output is the following: : In substitution of 'template int get(tuple<index_sequence<__integer_pack(sizeof ... (Ts ...))...>, Ts ...>) [with Ts = ]': :10:42: required from here :10:42: internal compiler error: tree check: expected template_parm_index, have call_expr in template_parm_level_and_index, at cp/pt.c:20594 int x = get(tuple<index_sequence_for<>>{}); ^ mmap: Invalid argument Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1 And the version info is: g++ (GCC-Explorer-Build) 8.0.1 20180322 (experimental) On a version of g++-8 installed from the Ubuntu repositories, the output is the following: tuple.cpp: In substitution of ‘template int get(tuple<std::integer_sequence, Ts ...>) [with Ts = ]’: tuple.cpp:7:47: required from here tuple.cpp:7:47: internal compiler error: Segmentation fault int x = get(tuple<std::index_sequence_for<>>{}); ^ Please submit a full bug report, with preprocessed source if appropriate. See for instructions. And the version info is: g++-8 (Ubuntu 8-20170923-1ubuntu2) 8.0.0 20170923 (experimental) [trunk revision 253118]
[Bug libstdc++/84110] Null character in regex
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84110 --- Comment #1 from AbigailBuccaneer --- From what I can tell, this isn't intentional behavior in libstdc++. regex_scanner.h defines: const char* _M_ecma_spec_char = "^$\\.*+?()[]{}|"; and regex_scanner.tcc tries to interpret any character not in this set of special characters as an ordinary character token: if (std::strchr(_M_spec_char, _M_ctype.narrow(__c, ' ')) == nullptr) { _M_token = _S_token_ord_char; _M_value.assign(1, __c); return; } However, the strchr specification says (emphasis mine): Description: The strchr function locates the first occurrence of c (converted to a char) in the string pointed to by s. ***The terminating null character is considered to be part of the string***.
[Bug libstdc++/84110] New: Null character in regex
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84110 Bug ID: 84110 Summary: Null character in regex Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: abigail.buccaneer at gmail dot com Target Milestone: --- The following code, when compiled with libstdc++: #include int main() { auto r = std::regex{"\0", std::size_t{1}}; } ...results in std::regex_error being thrown. My reading of the ECMAScript regex spec says that this should be allowed, and that a null byte should match a literal null byte: PatternCharacter :: SourceCharacter but not one of ^ $ \ . * + ? ( ) [ ] { } | SourceCharacter :: any Unicode code unit (Elsewhere in the ECMAScript spec, it explicitly specifies that an unrelated grammar production is 'SourceCharacter but not one of " or \ or U+ through U+001F', so it makes sense to assume that SourceCharacter here very intentionally includes null.) Clang/libc++ seems to agree with this reading, and successfully compiles and runs the following: #include #include int main() { auto null = std::string{"\0", std::size_t{1}}; std::smatch match_results; assert(std::regex_match(null, match_results, std::regex{null})); assert(match_results.position() == 0 && match_results.length() == 1 && match_results[0] == null); }
[Bug c++/83290] New: Expressions in anonymous unions inside class templates can't reference the union's members
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83290 Bug ID: 83290 Summary: Expressions in anonymous unions inside class templates can't reference the union's members Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: abigail.buccaneer at gmail dot com Target Milestone: --- The following code compiles fine (with -std=c++14): struct A { union { int x; char y[sizeof(x)]; decltype(x) z; static_assert(sizeof(y) == sizeof(z), ""); }; }; But fails when the struct is replaced with a struct template and instantiated as follows: template struct T { union { int x; char y[sizeof(x)]; decltype(x) z; static_assert(sizeof(y) == sizeof(z), ""); }; }; template struct T; The errors all say essentially the same thing: :13:23: error: 'int Tx' is inaccessible within this context char y[sizeof(x)]; ~^~
[Bug c++/60199] New: 'error: field initializer is not constant' error when initializing static member function pointer to a function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60199 Bug ID: 60199 Summary: 'error: field initializer is not constant' error when initializing static member function pointer to a function Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: abigail.buccaneer at gmail dot com The following code compiles in Clang 3.3, but not GCC 4.8.2: //--- // g++ -std=c++11 -Wall -Wextra -pedantic void f() {} static constexpr void (*g1)() = f; // ok static constexpr void (*g2)() = f; // ok struct S { static constexpr void (*g3)() = f; // ok static constexpr void (*g4)() = f; // error: field initializer is not constant }; //---