[Bug c++/66007] New: [5 Regression] Narrowing conversion inside { } results in all zero elements in C++11 mode
evangelos at foutrelis dot com
gcc-bugzilla@gcc.gnu.org
Mon May 4 14:13:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66007
Bug ID: 66007
Summary: [5 Regression] Narrowing conversion inside { } results
in all zero elements in C++11 mode
Product: gcc
Version: 5.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: evangelos at foutrelis dot com
Target Milestone: ---
Created attachment 35453
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35453&action=edit
Different narrowing behavior between GCC 4.9 and GCC 5
This is related to PR c++/65801 which allowed -Wno-narrowing to be used to
silence narrowing errors in C++11 mode.
Compiling something like "int foo[] = { 1, 0xFFFFFFFF, 3 };" with "-std=c++11
-Wno-error=narrowing" will initialize foo to {0, 0, 0}, whereas GCC 4.9 would
initialize it to {1, -1, 3}. (Attached is the assembler code generated by both
GCC versions.)
(This change in behavior causes at least one crash in Chromium; when using the
search box on the settings page, the tab will crash.)
More information about the Gcc-bugs
mailing list