[Bug libstdc++/93672] New: std::basic_istream::ignore hangs if delim MSB is set
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93672 Bug ID: 93672 Summary: std::basic_istream::ignore hangs if delim MSB is set Product: gcc Version: 9.1.0 URL: https://stackoverflow.com/questions/60140947/stdbasic- istreamignore-hangs-if-delim-msb-is-set Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: erenon2 at gmail dot com Target Milestone: --- The following program hangs: #include #include int main() { std::stringstream str; str.put('a'); // 1 str.put('\x80');// 2 str.put('a'); // 3 str.ignore(32, '\x80'); // hangs std::cout << str.tellg() << "\n"; } Removing any of the numbered lines (1,2,3) makes the problem go away. Using std::basic_stringstream does not exhibit the issue. Passing unsigned delim (that does not get sign extended) also fixes it. ASAN or UBSAN is silent. `-D_GLIBCXX_DEBUG` does not make a difference. GCC 5.4, 6.3, 8.2, 9.2 are affected.
[Bug c++/41091] Using section attribute in c and c++ function causes section type conflict
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41091 Benedek changed: What|Removed |Added CC||erenon2 at gmail dot com --- Comment #6 from Benedek --- The following code reproduces this, or a very similar issue: #define STORE(SECTION, STRING) \ __attribute__((section(SECTION), used)) \ static constexpr const char* s[] = { STRING } void f() { STORE(".custom", "normal_foobar"); } inline void g() { STORE(".custom", "inline_foobar"); } template void h() { STORE(".custom", "template_foobar"); } int main() { f(); g(); h(); return 0; } $ g++ -std=c++11 section.cpp section.cpp: error: 's' causes a section type conflict with 's' GCC 4.8, 5.2, 7.2, and trunk are affected (x86-64, checked on godbolt). Depending on the compiler version, either the normal and the inline, or the normal and the function template clashes. I suppose because of how comdat is handled, they might have slightly different needs, but it would be really nice to make it easier for the user. (Clang compiles it fine)
[Bug c++/97544] New: -Wtype-limits triggered for comparison to template argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97544 Bug ID: 97544 Summary: -Wtype-limits triggered for comparison to template argument Product: gcc Version: 10.2.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: erenon2 at gmail dot com Target Milestone: --- The following code triggers -Wtype-limits: template constexpr int f(unsigned i) { return (i < N) ? 0 : 1; } int main() { return f<0>(1); } On GCC 10.2 and trunk, it produces this warning: : In instantiation of 'constexpr int f(unsigned int) [with unsigned int N = 0]': :4:13: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits] 4 | return (i < N) ? 0 : 1; | ~~~^~~~ On GCC 10.1, there's no warning. godbolt: https://gcc.godbolt.org/z/cqzq8P
[Bug c++/97544] -Wtype-limits triggered for comparison to template argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97544 --- Comment #4 from Benedek Thaler --- FTR, Using (N != 0 && i < N) does not silence the warning. https://gcc.godbolt.org/z/WqaT3G