From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71501 invoked by alias); 3 Apr 2017 01:45:31 -0000 Mailing-List: contact overseers-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: , Sender: overseers-owner@sourceware.org Received: (qmail 71370 invoked by uid 89); 3 Apr 2017 01:45:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*r:sk:oversee X-HELO: mail-wr0-f175.google.com Received: from mail-wr0-f175.google.com (HELO mail-wr0-f175.google.com) (209.85.128.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Apr 2017 01:45:21 +0000 Received: by mail-wr0-f175.google.com with SMTP id k6so142884989wre.2 for ; Sun, 02 Apr 2017 18:45:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=dHAopr0jjmrsk9rbQz73X22kx/H8zAudrmPoBSmVw80=; b=tmUtEifAgJnxaaNB/a/+ooTJcIQptvJdWM5PW1ibsaTUBOh4GD3+VAZxC9cWjoBmZw gm7wTLf2giOXRzoGh7QFZqrA+FM7qFCWG/5d2M3aIGr+U2ZUR+J83XemTrIlGJ6JqZDi cjCK4JaTertdjNYk79Ab1LIQCAmkr39MuFho5kfY0GdRcRVGUEdLepc47vcaH2nfr7eM /XGRvdme6wuoflVtiIxQs3Ga29j9MiA96ZkFGLwtXJTKWkCB+sqVtY6k4jBHQ2oquYeI +AoaAp2dT0JH4Z/8sNsxgytB8sXA+SvTGcHXzdLsLd9Q54+o6BzHpWsaRqaLLZNOiDXb dMvw== X-Gm-Message-State: AFeK/H27BEjIB615XSQvb6zG03aOIec3+ceQQm6kmKWzb6Pq6TWCiOa4DjEC5DRJ5VTLif2kr4i8AgprGEhItw== X-Received: by 10.223.150.88 with SMTP id c24mr12064739wra.202.1491183916254; Sun, 02 Apr 2017 18:45:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.139.177 with HTTP; Sun, 2 Apr 2017 18:44:35 -0700 (PDT) From: Gregory Nisbet Date: Mon, 03 Apr 2017 01:45:00 -0000 Message-ID: Subject: Creating an account to report gcc bug To: overseers@gcc.gnu.org Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2017-q2/txt/msg00001.txt.bz2 Hi everyone, I'd like to report a GCC bug affecting version 6.3.0 on OS X, as distributed by macports. I do not believe it to be a packaging-related problem. I do not have an account. New account creation seems to be disabled. I'd like to create one, but if I did it would only be to report this bug. Here's the output of gcc -v % gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin16/6.3.0/lto-wrapper Target: x86_64-apple-darwin16 Configured with: /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc6/gcc6/work/gcc-6.3.0/configure --prefix=/opt/local --build=x86_64-apple-darwin16 --enable-languages=c,c++,objc,obj-c++,lto,fortran --libdir=/opt/local/lib/gcc6 --includedir=/opt/local/include/gcc6 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-6 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-6 --with-gxx-include-dir=/opt/local/include/gcc6/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-build-config=bootstrap-debug --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion='MacPorts gcc6 6.3.0_2' Thread model: posix gcc version 6.3.0 (MacPorts gcc6 6.3.0_2) Here are the SHA-256s of the gcc and g++ executables exhibiting the problematic behavior. % shasum -a 256 `which gcc` 5678eb76461ff32f23d24b92b1f2222722fca506f8b3c593a4783c839e4ff179 /opt/local/bin/gcc % shasum -a 256 `which g++` a8411548475c707d9e7e9c1f24aa21687be4621e98c27137082bae0323c510d4 /opt/local/bin/g++ Here are the two files involved in the issue. numlike.hpp template struct Numlike { class type { private: T t; public: type() { this->t = T(); } T value() { return this->t; } }; }; and the other file, numlike_test.cc #include "numlike.hpp" #include int main() { Numlike::type hi; printf("%d\n", hi.value()); } The order of the includes is important here. If those two files are included in a directory as is, then attempting to compile with `g++ numlike_test.cc` produces a few spurious fatal errors. % g++ numlike_test.cc numlike_test.cc: In function 'int main()': numlike_test.cc:5:3: error: 'Numlike' is not a template Numlike::type hi; ^~~~~~~ numlike_test.cc:5:22: error: qualified-id in declaration before 'hi' Numlike::type hi; ^~ numlike_test.cc:6:18: error: 'hi' was not declared in this scope printf("%d\n", hi.value()); ^~ Exit 1 `g++ -std=gnu++14 numlike_test.cc`, unsurprisingly, emits the same error, however these all compiled without error and produce no output. % g++ --std=gnu++17 numlike_test.cc % g++ --std=gnu++11 numlike_test.cc % g++ --std=c++17 numlike_test.cc % g++ --std=c++14 numlike_test.cc % g++ --std=c++11 numlike_test.cc % g++ --std=c++98 numlike_test.cc Interestingly, running the preprocessor separately is enough to prevent the expression of this bug. runs without error % gcc -E numlike_test.cc | g++ -x c++ --std=gnu++14 - this also runs without error % gcc -E numlike_test.cc > /tmp/a.cc ; g++ /tmp/a.cc Reordering the includes in numlike_test.cc so cstdio is included first also prevents the expression of the bug. i.e. if numlike_test.cc is replaced with this, then the bug does not occur. #include #include "numlike.hpp" int main() { Numlike::type hi; printf("%d\n", hi.value()); } I don't know enough to try to fix this on my own and submit a patch, but I would be more than happy to provide you with additional information if necessary. Thanks, Gregory P.S. Shar with file contents. # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # numlike.hpp # numlike_test.cc # echo x - numlike.hpp sed 's/^X//' >numlike.hpp << 'END-of-numlike.hpp' Xtemplate struct Numlike { X class type { X private: X T t; X X public: X type() { this->t = T(); } X T value() { return this->t; } X }; X}; END-of-numlike.hpp echo x - numlike_test.cc sed 's/^X//' >numlike_test.cc << 'END-of-numlike_test.cc' X#include "numlike.hpp" X#include X Xint main() { X Numlike::type hi; X printf("%d\n", hi.value()); X} END-of-numlike_test.cc exit