public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98919] New: auto declaration of multiple variables allows inconsistent types
@ 2021-02-01 16:15 stephan.oostveen@nextlevel-electronics.com
  2021-02-01 18:08 ` [Bug c++/98919] " redi at gcc dot gnu.org
  2021-02-01 18:10 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: stephan.oostveen@nextlevel-electronics.com @ 2021-02-01 16:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98919

            Bug ID: 98919
           Summary: auto declaration of multiple variables allows
                    inconsistent types
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stephan.oostveen@nextlevel-electronics.com
  Target Milestone: ---

Created attachment 50111
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50111&action=edit
Preprocessed file

gcc version: 10.2.1 20201125 (Red Hat 10.2.1-9) (GCC)
System version: Fedora 33 x86_64
Compile command: gcc -v -save-temps -std=c++17 -O3 -Wall -Wextra -Wpedantic -o
test test.cpp

auto allows to declare two different types in a single statement when used in a
templated context.

See also https://godbolt.org/z/brWYjP as an example.

Compiler output:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --with-isl --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.1 20201125 (Red Hat 10.2.1-9) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-O3' '-Wall' '-Wextra'
'-Wpedantic' '-o' 'test' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/10/cc1plus -E -quiet -v -D_GNU_SOURCE
test.cpp -mtune=generic -march=x86-64 -std=c++17 -Wall -Wextra -Wpedantic -O3
-fpch-preprocess -o test.ii
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/10/include-fixed"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/10/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10

/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux
 /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward
 /usr/lib/gcc/x86_64-redhat-linux/10/include
 /usr/local/include
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-O3' '-Wall' '-Wextra'
'-Wpedantic' '-o' 'test' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/10/cc1plus -fpreprocessed test.ii -quiet
-dumpbase test.cpp -mtune=generic -march=x86-64 -auxbase test -O3 -Wall -Wextra
-Wpedantic -std=c++17 -version -o test.s
GNU C++17 (GCC) version 10.2.1 20201125 (Red Hat 10.2.1-9)
(x86_64-redhat-linux)
        compiled by GNU C version 10.2.1 20201125 (Red Hat 10.2.1-9), GMP
version 6.2.0, MPFR version 4.1.0, MPC version 1.1.0, isl version
isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++17 (GCC) version 10.2.1 20201125 (Red Hat 10.2.1-9)
(x86_64-redhat-linux)
        compiled by GNU C version 10.2.1 20201125 (Red Hat 10.2.1-9), GMP
version 6.2.0, MPFR version 4.1.0, MPC version 1.1.0, isl version
isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9e47728dd41983b7aeec830bfccf6d2e
test.cpp: In instantiation of ‘constexpr void test() [with long unsigned int N
= 42]’:
test.cpp:15:14:   required from here
test.cpp:11:10: warning: unused variable ‘aIt’ [-Wunused-variable]
   11 |     auto aIt = begin(a), bIt = begin(b);
      |          ^~~
test.cpp:11:26: warning: unused variable ‘bIt’ [-Wunused-variable]
   11 |     auto aIt = begin(a), bIt = begin(b);
      |                          ^~~
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-O3' '-Wall' '-Wextra'
'-Wpedantic' '-o' 'test' '-mtune=generic' '-march=x86-64'
 as -v --64 -o test.o test.s
GNU assembler version 2.35 (x86_64-redhat-linux) using BFD version version
2.35-18.fc33
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/10/:/usr/libexec/gcc/x86_64-redhat-linux/10/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/10/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/10/:/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/10/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-O3' '-Wall' '-Wextra'
'-Wpedantic' '-o' 'test' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/10/collect2 -plugin
/usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so
-plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper
-plugin-opt=-fresolution=test.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id
--no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -o test
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crt1.o
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-redhat-linux/10/crtbegin.o
-L/usr/lib/gcc/x86_64-redhat-linux/10
-L/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64 -L/lib/../lib64
-L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/10/../../.. test.o -lgcc
--push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed
-lgcc_s --pop-state /usr/lib/gcc/x86_64-redhat-linux/10/crtend.o
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crtn.o
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-O3' '-Wall' '-Wextra'
'-Wpedantic' '-o' 'test' '-mtune=generic' '-march=x86-64'

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

* [Bug c++/98919] auto declaration of multiple variables allows inconsistent types
  2021-02-01 16:15 [Bug c++/98919] New: auto declaration of multiple variables allows inconsistent types stephan.oostveen@nextlevel-electronics.com
@ 2021-02-01 18:08 ` redi at gcc dot gnu.org
  2021-02-01 18:10 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-02-01 18:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98919

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think this is a duplicate of an existing (quite old) bug.

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

* [Bug c++/98919] auto declaration of multiple variables allows inconsistent types
  2021-02-01 16:15 [Bug c++/98919] New: auto declaration of multiple variables allows inconsistent types stephan.oostveen@nextlevel-electronics.com
  2021-02-01 18:08 ` [Bug c++/98919] " redi at gcc dot gnu.org
@ 2021-02-01 18:10 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-02-01 18:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98919

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Found it:

*** This bug has been marked as a duplicate of bug 79009 ***

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

end of thread, other threads:[~2021-02-01 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 16:15 [Bug c++/98919] New: auto declaration of multiple variables allows inconsistent types stephan.oostveen@nextlevel-electronics.com
2021-02-01 18:08 ` [Bug c++/98919] " redi at gcc dot gnu.org
2021-02-01 18:10 ` 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).