public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/60304] New: Including <atomic> disables -Wconversion-null
@ 2014-02-21 15:59 bug-reports at psdtechnologies dot com
  2014-02-21 18:24 ` [Bug preprocessor/60304] " harald at gigawatt dot nl
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: bug-reports at psdtechnologies dot com @ 2014-02-21 15:59 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 8104 bytes --]

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60304

            Bug ID: 60304
           Summary: Including <atomic> disables -Wconversion-null
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bug-reports at psdtechnologies dot com

Created attachment 32190
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32190&action=edit
Minimal example of bug (does not emit warning)

Compiling any code with '#include <atomic>' disables the conversion-null
warning, but only when compiling directly from source; preprocessing separately
does not reproduce the bug.

I've attached minimal examples, reproduced here since they're so short (1-2
lines)


This file behaves as expected (warning.cpp):
"""
int * foo() {return false;}
"""

$ g++-4.8 -std=c++11 -c warning.cpp 
warning.cpp: In function ‘int* foo()’:
warning.cpp:1:21: warning: converting ‘false’ to pointer type ‘int*’
[-Wconversion-null]
 int * foo() {return false;}
                     ^

This warning is expected since -Wconversion-null is enabled by default. It also
can be made to error as expected using -Wall or by inserting 

"""
#pragma GCC diagnostic error "-Wconversion-null" 
"""

in the source prior to the function.



This file (differing only by the inclusion of <atomic> does not issue the
warning, and cannot be made to error or warn even with the pragma:

"""
#include <atomic>
int * foo() {return false;}
"""

g++-4.8 -std=c++11 -c nowarning.cpp # success

Compiling incrementally, though, restores the expected behavior:

g++-4.8 -std=c++11 -E nowarning.cpp -o nowarning.i # success
g++-4.8 -std=c++11 -c nowarning.i
nowarning.cpp: In function ‘int* foo()’:
nowarning.cpp:2:21: warning: converting ‘false’ to pointer type ‘int*’
[-Wconversion-null]
 int * foo() {return false;}
                     ^

As does using -save-temps:

g++-4.8 -std=c++11 -save-temps -c nowarning.cpp
nowarning.cpp: In function ‘int* foo()’:
nowarning.cpp:2:21: warning: converting ‘false’ to pointer type ‘int*’
[-Wconversion-null]
 int * foo() {return false;}
                     ^




Version information:
g++-4.8 -std=c++11 -v -c nowarning.cpp
Using built-in specs.
COLLECT_GCC=g++-4.8
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.8.1-2ubuntu1~12.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~12.04) 
COLLECT_GCC_OPTIONS='-std=c++11' '-v' '-c' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.8/cc1plus -quiet -v -imultilib . -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE nowarning.cpp -quiet -dumpbase nowarning.cpp
-mtune=generic -march=x86-64 -auxbase nowarning -std=c++11 -version
-fstack-protector -o /tmp/ccCyoaqJ.s
GNU C++ (Ubuntu 4.8.1-2ubuntu1~12.04) version 4.8.1 (x86_64-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 5.0.2, MPFR version 3.1.0-p3,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/4.8"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.8
 /usr/include/x86_64-linux-gnu/c++/4.8/.
 /usr/include/c++/4.8/backward
 /usr/lib/gcc/x86_64-linux-gnu/4.8/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++ (Ubuntu 4.8.1-2ubuntu1~12.04) version 4.8.1 (x86_64-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 5.0.2, MPFR version 3.1.0-p3,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 227d7ccf008db5ae401be7ddcc6b4746
COLLECT_GCC_OPTIONS='-std=c++11' '-v' '-c' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 as -v --64 -o nowarning.o /tmp/ccCyoaqJ.s
GNU assembler version 2.22 (x86_64-linux-gnu) using BFD version (GNU Binutils
for Ubuntu) 2.22
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-std=c++11' '-v' '-c' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
>From gcc-bugs-return-444520-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Feb 21 16:00:01 2014
Return-Path: <gcc-bugs-return-444520-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3795 invoked by alias); 21 Feb 2014 16:00:01 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 3769 invoked by uid 48); 21 Feb 2014 15:59:58 -0000
From: "bug-reports at psdtechnologies dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/60304] Including <atomic> disables -Wconversion-null
Date: Fri, 21 Feb 2014 16:00:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: preprocessor
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: bug-reports at psdtechnologies dot com
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: attachments.created
Message-ID: <bug-60304-4-GNwatGETx3@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60304-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60304-4@http.gcc.gnu.org/bugzilla/>
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-02/txt/msg02277.txt.bz2
Content-length: 244

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`304

--- Comment #1 from bug-reports at psdtechnologies dot com ---
Created attachment 32191
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id2191&actioníit
Similar code behaving as expected


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2020-09-05 12:12 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-21 15:59 [Bug preprocessor/60304] New: Including <atomic> disables -Wconversion-null bug-reports at psdtechnologies dot com
2014-02-21 18:24 ` [Bug preprocessor/60304] " harald at gigawatt dot nl
2014-10-24  9:05 ` [Bug c++/60304] " paolo.carlini at oracle dot com
2014-10-24  9:29 ` paolo.carlini at oracle dot com
2014-10-24  9:35 ` redi at gcc dot gnu.org
2014-10-24  9:44 ` paolo.carlini at oracle dot com
2014-10-24  9:51 ` redi at gcc dot gnu.org
2014-10-24 11:33 ` paolo.carlini at oracle dot com
2014-10-24 12:01 ` redi at gcc dot gnu.org
2014-10-24 12:27 ` jakub at gcc dot gnu.org
2014-10-24 13:19 ` redi at gcc dot gnu.org
2014-10-24 13:23 ` manu at gcc dot gnu.org
2014-10-24 13:49 ` manu at gcc dot gnu.org
2014-10-24 14:51 ` redi at gcc dot gnu.org
2014-10-24 16:20 ` manu at gcc dot gnu.org
2020-09-02 15:32 ` [Bug c++/60304] Including <stdbool.h> disables -Wconversion-null in C++ 98 mode redi at gcc dot gnu.org
2020-09-02 15:58 ` redi at gcc dot gnu.org
2020-09-02 16:03 ` redi at gcc dot gnu.org
2020-09-02 19:50 ` cvs-commit at gcc dot gnu.org
2020-09-02 19:52 ` redi at gcc dot gnu.org
2020-09-05 11:13 ` harald at gigawatt dot nl
2020-09-05 12:12 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).