Package: g++-14-arm-linux-gnueabihf
Version: 14.1.0-5
Severity: important

Dear Maintainer,

I have the following minimal program that does not compile on armhf with
-O. It however *does* compile without the optimization flag, or with or
without -O on amd64 and other architectures. (I'm maintaining
msc-generator that FTBFS [1] on armhf/armel due to this.) 

The program and transcript on armhf-in-qemu follows:

$ cat fwdecl.cc
#include <vector>
class Elem;
struct List : std::vector<Elem> {
    List() {}
};
struct Elem {};

$ g++ -std=c++23 fwdecl.cc -S -O
In file included from /usr/include/c++/14/vector:66,
                 from fwdecl.cc:1:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'constexpr
std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = Elem; _Alloc
= std::allocator<Elem>]':
/usr/include/c++/14/bits/stl_vector.h:531:7:   required from here
  531 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:369:49: error: invalid use of
incomplete type 'class Elem'
  369 |                       _M_impl._M_end_of_storage -
_M_impl._M_start);
      |                      
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
fwdecl.cc:2:7: note: forward declaration of 'class Elem'
    2 | class Elem;
      |       ^~~~

$ g++ -std=c++23 fwdecl.cc -S  # exits OK

$ g++ --version
g++ (Debian 14.1.0-5) 14.1.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

Caveat: if the List ctor is defaulted, it compiles. As does on amd64 for
the reference:

$ g++ --version
g++ (Debian 14.1.0-5) 14.1.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

$ uname -a
Linux 814523ba7101 6.8.12-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.8.12-1
(2024-05-31) x86_64 GNU/Linux

$ g++ -std=c++23 fwdecl.cc -S -O

$ g++ -std=c++23 fwdecl.cc -S 

$ dpkg -l | grep 'g++'
ii  g++                                   4:14.1.0-2                    
  amd64        GNU C++ compiler
ii  g++-14                                14.1.0-5                      
  amd64        GNU C++ compiler
ii  g++-14-x86-64-linux-gnu               14.1.0-5                      
  amd64        GNU C++ compiler for x86_64-linux-gnu architecture
ii  g++-x86-64-linux-gnu                  4:14.1.0-2                    
  amd64        GNU C++ compiler for the amd64 architecture

BR,
Gábor

[1]
https://buildd.debian.org/status/fetch.php?pkg=msc-generator&arch=armhf&ver=8.6.2-1&stamp=1722276981&raw=0

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: armhf (armv7l)

Kernel: Linux 6.8.12-armmp (SMP w/1 CPU thread)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages g++-14-arm-linux-gnueabihf depends on:
ii  gcc-14-arm-linux-gnueabihf  14.1.0-5
ii  gcc-14-base                 14.1.0-5
ii  libc6                       2.39-6
ii  libgmp10                    2:6.3.0+dfsg-2+b1
ii  libisl23                    0.26-3+b2
ii  libmpc3                     1.3.1-1+b2
ii  libmpfr6                    4.2.1-1+b1
ii  libstdc++-14-dev            14.1.0-5
ii  libzstd1                    1.5.6+dfsg-1
ii  zlib1g                      1:1.3.dfsg+really1.3.1-1

g++-14-arm-linux-gnueabihf recommends no packages.

Versions of packages g++-14-arm-linux-gnueabihf suggests:
pn  gcc-14-doc  <none>

-- no debconf information

Reply via email to