From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19497 invoked by alias); 24 Apr 2014 19:09:31 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19456 invoked by uid 48); 24 Apr 2014 19:09:26 -0000 From: "matt at godbolt dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60955] New: Erroneous warning about taking address of register with std=c++1y Date: Thu, 24 Apr 2014 19:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: matt at godbolt dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg01840.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D60955 Bug ID: 60955 Summary: Erroneous warning about taking address of register with std=3Dc++1y Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: matt at godbolt dot org This short snippet, when compiled with GCC4.9.0 and -Wextra and -std=3Dc++1= y, gives an erroneous warning about taking the address of a register: =3D=3D=3D $ cat test2.cc // compile with -Wextra -std=3Dc++1y unsigned int erroneous_warning(register int a) { if ((a) & 0xff) return 1; else return 0; } unsigned int no_erroneous_warning(register int a) { if (a & 0xff) return 1; else return 0; } $ g++ -Wextra -std=3Dc++11 -c test2.cc test2.cc: In function =E2=80=98unsigned int erroneous_warning(int)=E2=80=99: test2.cc:3:10: warning: address requested for =E2=80=98a=E2=80=99, which is= declared =E2=80=98register=E2=80=99 [-Wextra] if ((a) & 0xff) return 1; else return 0; ^ $ g++ -v Using built-in specs. COLLECT_GCC=3D/home/mgodbolt/.fighome/runtime/gcc/4.9.0-2/bin/g++ COLLECT_LTO_WRAPPER=3D/mnt/data/fighome/runtime/gcc/4.9.0-2/bin/../libexec/= gcc/x86_64-linux-gnu/4.9.0/lto-wrapper Target: x86_64-linux-gnu Configured with: ../gcc-4.9.0/configure --prefix /data/teamcity/work/sud-chibld05-002-RHEL6/9d49ff0b2777552a/scratch/gcc/4.9= .0/staging --build=3Dx86_64-linux-gnu --disable-multilibs --enable-clocale=3Dgnu --enable-languages=3Dc,c++ --enable-ld=3Dyes --enable-gold=3Dyes --enable-libstdcxx-debug --enable-libstdcxx-time=3Dyes --enable-linker-buil= d-id --enable-lto --enable-plugins --enable-threads=3Dposix --host=3Dx86_64-linu= x-gnu --target=3Dx86_64-linux-gnu --with-pkgversion=3DDRW-internal-build --with-system-zlib --disable-werror --with-libelf=3D/data/teamcity/work/sud-chibld05-002-RHEL6/9d49ff0b2777552a= /scratch/gcc/4.9.0/build/libelf-0.8.13 Thread model: posix gcc version 4.9.0 (DRW-internal-build)=20 =3D=3D=3D When compiled with -std=3Dc++11 the warning disappears. Note the extra parentheses are also needed to trigger the warning. >>From gcc-bugs-return-449821-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Apr 24 19:36:32 2014 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 4416 invoked by alias); 24 Apr 2014 19:36:31 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 4351 invoked by uid 48); 24 Apr 2014 19:36:25 -0000 From: "matt at godbolt dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60955] Erroneous warning about taking address of register with std=c++1y Date: Thu, 24 Apr 2014 19:36:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: matt at godbolt dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg01841.txt.bz2 Content-length: 388 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60955 --- Comment #1 from Matt Godbolt --- The previous snippet wasn't quite as minimal as it could be. This single line also reproduces it: unsigned int erroneous_warning(register int a) { return (a); } Jonathan Wakely mentioned this may be related to this bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57573