[Bug c++/88602] Consider adding ext_vector_type for better clang compatibility

2024-05-20 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88602

Jean-Michaël Celerier  changed:

   What|Removed |Added

 CC||jeanmichael.celerier@gmail.
   ||com

--- Comment #4 from Jean-Michaël Celerier  ---
Another vote for this. It's used in the KFR DSP library which for this reason
gets restricted to clang in some configurations...

Compare

https://github.com/kfrlib/kfr/blob/main/include/kfr/simd/impl/backend_clang.hpp

and

https://github.com/kfrlib/kfr/blob/main/include/kfr/simd/impl/backend_generic.hpp

[Bug c++/111748] New: GCC does not understand partial ordering between non-constrained and constrained templates for specialization

2023-10-09 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111748

Bug ID: 111748
   Summary: GCC does not understand partial ordering between
non-constrained and constrained templates for
specialization
   Product: gcc
   Version: 13.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeanmichael.celerier at gmail dot com
  Target Milestone: ---

Consider: 

#include

template
void foo() { }

template 
void foo() { }

template<> 
void foo() { }

int main() { foo(); }


According to the answers I got in https://stackoverflow.com/questions/77261120/
GCC should be able to compile this code, yet it fails due to a supposed
ambiguity between 

template
void foo() { }

and

template 
void foo() { }

as the base of foo

[Bug sanitizer/110936] New: if constexpr: member function pointers cannot be checked with ubsan

2023-08-07 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110936

Bug ID: 110936
   Summary: if constexpr: member function pointers cannot be
checked with ubsan
   Product: gcc
   Version: 13.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeanmichael.celerier at gmail dot com
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---

Repro:

struct foo {
  void bar() { }
};

void process(auto f) {
  if constexpr((f)::bar);
}

int main() {
  process(foo{});
}


Works fine in normal compilation mode as expected, however with
-fsanitize=undefined it does not work: https://gcc.godbolt.org/z/9qvz89na8

:6:3: error: '(foo::bar != 0)' is not a constant expression
  if constexpr((f)::bar);

I tested as far back as g++ 7.1 and it did not work either back then, and prior
versions did not have if constexpr.

It would be less of a problem if there was any way to do #if
defined(__SANITIZE_UNDEFINED__) or something similar but while asan has it,
ubsan does not seem to have any macro to enable detection of it.

[Bug c++/109899] New: ICE in check_noexcept_r, at cp/except.cc:1065

2023-05-17 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109899

Bug ID: 109899
   Summary: ICE in check_noexcept_r, at cp/except.cc:1065
   Product: gcc
   Version: 13.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeanmichael.celerier at gmail dot com
  Target Milestone: ---

Created attachment 55106
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55106=edit
Preprocessed source causing the bug

Repro: 

#include 
#include 
#include 
struct T {
  struct {
// Works fine for value == std::array or std::string directly
std::array value;
  } X;
};

int main() {
  boost::pfr::detail::fields_count();
}

On godbolt: https://gcc.godbolt.org/z/xd48obMTv

Preprocessed source attached.

g++ 13.1.1 up-to-date in Arch Linux as of today, and it fails on any Boost
version that has  (from 1.75 to 1.82+).

[Bug c++/109651] ICE in lookup_template_class

2023-04-27 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109651

--- Comment #3 from Jean-Michaël Celerier  ---
Created attachment 54943
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54943=edit
Preprocessed source

[Bug c++/109651] New: ICE in lookup_template_class

2023-04-27 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109651

Bug ID: 109651
   Summary: ICE in lookup_template_class
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeanmichael.celerier at gmail dot com
  Target Milestone: ---

g++ version: g++ (SUSE Linux) 13.0.1 20230421 (prerelease) [revision
f980561c60b0446cc427595198d7f3f4f90e0924]
as shipped by opensuse tumbleweed (reproducible in the official
opensuse/tumbleweed:latest container)

preprocessed source as given by -freport-bug attached.


/usr/bin/g++-13 -DBOOST_ASIO_DISABLE_CONCEPTS=1
-DBOOST_MATH_DISABLE_FLOAT128=1 -DBOOST_NO_RTTI=1 -DLIBREMIDI_ALSA
-DLIBREMIDI_JACK -DQT_CORE_LIB -DQT_DISABLE_DEPRECATED_BEFORE=0x0605ff
-DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_NO_JAVA_STYLE_ITERATORS
-DQT_NO_KEYWORDS -DQT_NO_LINKED_LIST -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
-DQT_NO_USING_NAMESPACE -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QML_LIB
-DQT_SERIALPORT_LIB -DQT_SHADERTOOLS_LIB -DQT_STATEMACHINE_LIB
-DQT_USE_QSTRINGBUILDER -DQT_WEBSOCKETS_LIB -DQT_WIDGETS_LIB
-DRAPIDJSON_HAS_STDSTRING=1 -DSCORE_ADDON_NETWORK_EXPORTS -DSCORE_LIB_BASE
-DSCORE_LIB_DEVICE -DSCORE_LIB_INSPECTOR -DSCORE_LIB_LOCALTREE
-DSCORE_LIB_PCH_EXPORTS -DSCORE_LIB_PROCESS -DSCORE_LIB_STATE
-DSCORE_PLUGIN_AUDIO -DSCORE_PLUGIN_AUTOMATION -DSCORE_PLUGIN_AVND
-DSCORE_PLUGIN_CURVE -DSCORE_PLUGIN_DATAFLOW -DSCORE_PLUGIN_DEVICEEXPLORER
-DSCORE_PLUGIN_ENGINE -DSCORE_PLUGIN_GFX -DSCORE_PLUGIN_LIBRARY
-DSCORE_PLUGIN_MEDIA -DSCORE_PLUGIN_SCENARIO -DSCORE_PLUGIN_TRANSPORT
-DSERVUS_USE_AVAHI_CLIENT -DTINYSPLINE_DOUBLE_PRECISION
-I/tmp/build/src/addons/iscore-addon-network
-I/ossia/score/src/addons/iscore-addon-network -I/tmp/build
-I/ossia/score/3rdparty -I/ossia/score/3rdparty/zipdownloader/src
-I/ossia/score/3rdparty/QProgressIndicator
-I/ossia/score/3rdparty/Qt-Color-Widgets
-I/ossia/score/3rdparty/Qt-Color-Widgets/src
-I/ossia/score/3rdparty/Qt-Color-Widgets/QtColorWidgets
-I/ossia/score/3rdparty/libossia/3rdparty/verdigris/src -I/tmp/build/src/lib
-I/ossia/score/src/lib -I/ossia/score/3rdparty/libossia/3rdparty/Flicks
-I/ossia/score/3rdparty/libossia/src -I/tmp/build/3rdparty/libossia/src
-I/ossia/score/3rdparty/libossia/3rdparty/Servus/servus/..
-I/ossia/score/3rdparty/QCodeEditor/include
-I/tmp/build/src/plugins/score-plugin-scenario
-I/ossia/score/src/plugins/score-plugin-scenario
-I/usr/include/qt6/QtDBus/6.5.0 -I/usr/include/qt6/QtDBus/6.5.0/QtDBus
-I/tmp/build/src/plugins/score-lib-process
-I/ossia/score/src/plugins/score-lib-process
-I/tmp/build/src/plugins/score-lib-state
-I/ossia/score/src/plugins/score-lib-state
-I/tmp/build/src/plugins/score-lib-inspector
-I/ossia/score/src/plugins/score-lib-inspector
-I/tmp/build/src/plugins/score-lib-device
-I/ossia/score/src/plugins/score-lib-device
-I/tmp/build/src/plugins/score-lib-localtree
-I/ossia/score/src/plugins/score-lib-localtree
-I/tmp/build/src/plugins/score-plugin-deviceexplorer
-I/ossia/score/src/plugins/score-plugin-deviceexplorer
-I/tmp/build/src/plugins/score-plugin-curve
-I/ossia/score/src/plugins/score-plugin-curve
-I/tmp/build/src/plugins/score-plugin-automation
-I/ossia/score/src/plugins/score-plugin-automation
-I/tmp/build/src/plugins/score-plugin-library
-I/ossia/score/src/plugins/score-plugin-library
-I/tmp/build/src/plugins/score-plugin-transport
-I/ossia/score/src/plugins/score-plugin-transport
-I/tmp/build/src/plugins/score-plugin-engine
-I/ossia/score/src/plugins/score-plugin-engine
-I/tmp/build/src/plugins/score-plugin-audio
-I/ossia/score/src/plugins/score-plugin-audio
-I/tmp/build/src/plugins/score-plugin-avnd
-I/ossia/score/src/plugins/score-plugin-avnd
-I/tmp/build/src/plugins/score-plugin-media
-I/ossia/score/src/plugins/score-plugin-media
-I/tmp/build/src/plugins/score-plugin-dataflow
-I/ossia/score/src/plugins/score-plugin-dataflow
-I/ossia/score/3rdparty/libossia/3rdparty
-I/ossia/score/3rdparty/DSPFilters/DSPFilters/include
-I/ossia/score/3rdparty/Gamma -I/tmp/build/src/plugins/score-plugin-gfx
-I/ossia/score/src/plugins/score-plugin-gfx -I/tmp/build/3rdparty/snappy
-I/ossia/score/3rdparty/snappy -isystem
/ossia/score/3rdparty/libossia/3rdparty/nano-signal-slot -isystem
/ossia/score/3rdparty/libossia/3rdparty/brigand -isystem
/ossia/score/3rdparty/libossia/3rdparty/readerwriterqueue -isystem
/ossia/score/3rdparty/magicitems/include -isystem
/ossia/score/3rdparty/avendish/include -isystem
/ossia/score/3rdparty/libossia/3rdparty/boost_1_81_0 -isystem
/ossia/score/3rdparty/libossia/3rdparty/rnd/include -isystem
/usr/include/qt6/QtCore -isystem /usr/include/qt6 -isystem
/usr/lib64/qt6/mkspecs/linux-g++ -isystem /usr/include/qt6/QtGui -isystem
/usr/include/qt6/QtGui/6.5.0 -isystem /usr/include/qt6/QtGui/6.5.0/QtGui
-isystem /usr/include/qt6/QtCore/6.5.0 -isystem
/usr/include/qt6/QtCore/6.5.0/QtCore -isystem 

[Bug c++/107579] ICE on fold-expression on .* member access operator

2022-11-08 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107579

--- Comment #4 from Jean-Michaël Celerier  ---
Adding an explicit "member..." to the lambda capture, e.g. [&, member...] makes
it work

[Bug c++/107579] ICE on fold-expression on .* member access operator

2022-11-08 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107579

--- Comment #3 from Jean-Michaël Celerier  ---
It worked in 11.2 and started failing in 11.3. 

Short repro: https://gcc.godbolt.org/z/GYYbrTdxh 


#include 

template 
constexpr void for_each_field(T&& value, F&& func)
{
  using namespace boost::pfr;
  using namespace boost::pfr::detail;
  constexpr std::size_t fields_count_val =
fields_count>();

  auto t = boost::pfr::detail::tie_as_tuple(value);

  [&](std::index_sequence)
  {
(func(get(t)), ...);
  }
  (std::make_index_sequence{});
}

constexpr int index_in_struct(const auto& s, auto... member)
{
  int index = -1;
  int k = 0;

  for_each_field(s, [&](auto& m) {
if constexpr(requires { bool( == &(s.**member)); })
{
  if( == &(s.**member))
  {
index = k;
  }
}
++k;
  });


  return index;
}

struct X
{
int z;
};

int main()
{
constexpr int r = index_in_struct(X{}, ::z);
}

[Bug c++/107579] ICE on fold-expression on .* member access operator

2022-11-08 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107579

--- Comment #2 from Jean-Michaël Celerier  ---
Clang and MSVC compiles the same thing correctly

[Bug c++/107579] ICE on fold-expression on .* member access operator

2022-11-08 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107579

--- Comment #1 from Jean-Michaël Celerier  ---
Created attachment 53851
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53851=edit
bug report provided by -fbug-report

[Bug c++/107579] New: ICE on fold-expression on .* member access operator

2022-11-08 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107579

Bug ID: 107579
   Summary: ICE on fold-expression on .* member access operator
   Product: gcc
   Version: 12.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeanmichael.celerier at gmail dot com
  Target Milestone: ---

The function that is causing the ICE:

```
constexpr int index_in_struct(const auto& s, auto... member)
{
  int index = -1;
  int k = 0;

  avnd::for_each_field_ref(s, [&](auto& m) {
if constexpr(requires { bool( == &(s.**member)); })
{
  if( == &(s.**member))
  {
index = k;
  }
}
++k;
  });
  assert(index >= 0);
  return index;
}
```

The error:

/home/jcelerier/score/3rdparty/avendish/include/avnd/common/for_nth.hpp:114:26:
internal compiler error: trying to capture 'member#0' in instantiation of
generic lambda
  114 |   if( == &(s.**member))
  |  ^~
0x19eab38 internal_error(char const*, ...)
???:0
0x71c547 add_capture(tree_node*, tree_node*, tree_node*, bool, bool)
???:0
0x71c5b3 add_default_capture(tree_node*, tree_node*, tree_node*)
???:0
0x7e232a tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
???:0
0x7e0baa tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
???:0
0x7e8d8c tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
???:0
0x7dff89 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
???:0
0x7e0d41 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
???:0
0x7dfdeb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
???:0
0x7db043 instantiate_decl(tree_node*, bool, bool)
???:0
0x6edb1b mark_used(tree_node*, int)
???:0
0x68b85f build_op_call(tree_node*, vec**, int)
???:0
0x810f2d finish_call_expr(tree_node*, vec**, bool,
bool, int)
???:0
0x7e1f0c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
???:0
0x7e8d8c tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
???:0
0x7dff89 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
???:0
0x7db043 instantiate_decl(tree_node*, bool, bool)
???:0
0x6edb1b mark_used(tree_node*, int)
???:0
0x68b85f build_op_call(tree_node*, vec**, int)
???:0
0x810f2d finish_call_expr(tree_node*, vec**, bool,
bool, int)
???:0

[Bug c++/106668] ICE: friend function in struct declaration in generic lambda

2022-08-17 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106668

--- Comment #1 from Jean-Michaël Celerier  ---
When checking on gcc.godbolt.org it seems that it crashes as far back as GCC
4.9.0 (and 4.8 doesn't seem to be able to compile generic lambdas)

[Bug c++/106668] New: ICE: friend function in struct declaration in generic lambda

2022-08-17 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106668

Bug ID: 106668
   Summary: ICE: friend function in struct declaration in generic
lambda
   Product: gcc
   Version: 12.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeanmichael.celerier at gmail dot com
  Target Milestone: ---

Repro: foo.cpp

void foo();
bool ok = [] (auto x) {
  struct y {
  friend void foo();
  };
  return 0;
}(0);


build:

$ g++ foo.cpp

: In instantiation of ' [with auto:1 = int]':
:7:6:   required from here
:3:14: internal compiler error: Segmentation fault
3 |   struct y {
  |  ^
0x1ba65f9 internal_error(char const*, ...)
???:0
0x878158 instantiate_decl(tree_node*, bool, bool)
???:0
0x8936ab instantiate_pending_templates(int)
???:0
0x79c46d c_parse_final_cleanups()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
ASM generation compiler returned: 1
: In instantiation of ' [with auto:1 = int]':
:7:6:   required from here
:3:14: internal compiler error: Segmentation fault
3 |   struct y {
  |  ^
0x1ba65f9 internal_error(char const*, ...)
???:0
0x878158 instantiate_decl(tree_node*, bool, bool)
???:0
0x8936ab instantiate_pending_templates(int)
???:0
0x79c46d c_parse_final_cleanups()
???:0


It fails in c++14, 17 and 20 modes

[Bug c++/105683] New: [12 Regression] Infinite loop with construction of vector of variant

2022-05-21 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105683

Bug ID: 105683
   Summary: [12 Regression] Infinite loop with construction of
vector of variant
   Product: gcc
   Version: 12.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeanmichael.celerier at gmail dot com
  Target Milestone: ---

Created attachment 53012
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53012=edit
Full repro

Hello,

Full repro attached (g++ -std=gnu++20 repro.cpp && ./a.out is enough to trigger
the issue).
Same code works fine for every GCC version < 12 in c++17, c++20, as well as
with every released clang version in c++17, c++20, with both libc++ and
libstdc++.

My code more-or-less looks like this (trying to keep only the relevant parts):



// line 58584
struct value_variant_type {
  union Impl { std::vector m_value8; } m_impl;

  value_variant_type(const std::vector& v); 
  value_variant_type(std::vector&& v);
};


// line 58681
class value {
  value_variant_type v;
  value(const std::vector& val) noexcept : v{val}
  {
  }
  explicit value(std::vector&& val) noexcept :
v{std::move(val)}
  {
  }
};



// line 75925
inline value_variant_type::value_variant_type(const
std::vector& v) : m_type{Type8}
{
  new (_impl.m_value8) std::vector(v);
}

inline value_variant_type::value_variant_type(std::vector&&
v) : m_type{Type8}
{
  new (_impl.m_value8) std::vector(std::move(v));
}




// line 58916
inline ossia::value init_value(ossia::val_type type)
{
  return std::vector{};
}



// line 76232
void create_value_inline(ossia::value& v, ossia::val_type t) {
  v = ossia::init_value(t);
}

int main()
{
ossia::value v;
create_value_inline(v, ossia::val_type::LIST);
}


What it looks that is happening is a loop between the construction of the value
and of the vector: 


#1822 0x87b7 in ossia::value::value (other=...,
this=0x55abff10)
at
/home/jcelerier/ossia/score/3rdparty/libossia/src/ossia/network/value/value.hpp:302
#1823 std::_Construct
(__p=0x55abff10) at /usr/include/c++/12.1.0/bits/stl_construct.h:119
#1824 std::__do_uninit_copy
(__result=, __last=, __first=0x7f802a50)
at /usr/include/c++/12.1.0/bits/stl_uninitialized.h:120
#1825 std::__uninitialized_copy::__uninit_copy (__result=, __last=, 
__first=) at
/usr/include/c++/12.1.0/bits/stl_uninitialized.h:137
#1826 std::uninitialized_copy
(__result=, __last=, __first=)
at /usr/include/c++/12.1.0/bits/stl_uninitialized.h:185
#1827 std::__uninitialized_copy_a (__result=0x55abff10, __last=0x7f802a78,
__first=0x7f802a50)
at /usr/include/c++/12.1.0/bits/stl_uninitialized.h:372
#1828 std::vector
>::_M_range_initialize (__last=0x7f802a78,
__first=0x7f802a50, 
this=0x55abfee0) at /usr/include/c++/12.1.0/bits/stl_vector.h:1690
#1829 std::vector >::vector
(__a=..., Python Exception : value has been optimized out
__l=, this=0x55abfee0) at /usr/include/c++/12.1.0/bits/stl_vector.h:677
#1830 ossia::value_variant_type::value_variant_type (other=...,
this=0x55abfee0)
at
/home/jcelerier/ossia/score/3rdparty/libossia/src/ossia/network/value/value_variant_impl.hpp:17017
#1831 ossia::value::value (other=..., this=0x55abfee0) at
/home/jcelerier/ossia/score/3rdparty/libossia/src/ossia/network/value/value.hpp:302

[Bug c++/102990] [9/10/11 Regression] ICE in tsubst_copy_and_build with NSDMI and double to int conversion

2022-03-28 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102990

--- Comment #12 from Jean-Michaël Celerier  ---
In any case many thanks for fixing this !

[Bug c++/102990] [9/10/11 Regression] ICE in tsubst_copy_and_build with NSDMI and double to int conversion

2022-03-28 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102990

--- Comment #11 from Jean-Michaël Celerier  ---
Do you know if the patch will be applied to the 10.x / 11.x branches ?

[Bug c++/104720] New: internal compiler error: in tsubst_copy_and_build, at cp/pt.c:19817

2022-02-28 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104720

Bug ID: 104720
   Summary: internal compiler error: in tsubst_copy_and_build, at
cp/pt.c:19817
   Product: gcc
   Version: 11.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeanmichael.celerier at gmail dot com
  Target Milestone: ---

Created attachment 52527
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52527=edit
Repro for the bug

Repro:

```
$ g++ -std=c++20 processed.cpp -fcoroutines -fext-numeric-literals 

In file included from /usr/include/boost/pfr/detail/core17.hpp:11,
 from /usr/include/boost/pfr/detail/core.hpp:17,
 from /usr/include/boost/pfr/core.hpp:12,
 from /usr/include/boost/pfr.hpp:12,
 from
/home/jcelerier/ossia/score/3rdparty/avendish/include/avnd/concepts/generic.hpp:7,
 from
/home/jcelerier/ossia/score/3rdparty/avendish/include/avnd/concepts/audio_port.hpp:5,
 from
/home/jcelerier/ossia/score/3rdparty/avendish/examples/Oscr/ControlGallery.hpp:2,
 from /tmp/av/build/examples__ControlGallery_ossia.cpp:3:
/usr/include/boost/pfr/detail/fields_count.hpp: In substitution of
‘template constexpr decltype (sizeof (T{}))
boost::pfr::detail::detect_fields_count_dispatch(boost::pfr::detail::size_t_,
long int, int) [with T = examples::ControlGallery::; long
unsigned int N = ]’:
/usr/include/boost/pfr/detail/fields_count.hpp:305:78:   required from
‘constexpr std::size_t boost::pfr::detail::fields_count() [with T = const
examples::ControlGallery::; std::size_t = long unsigned int]’
/usr/include/boost/pfr/detail/core17.hpp:54:54:   required from ‘constexpr auto
boost::pfr::detail::tie_as_tuple(T&) [with T = const
examples::ControlGallery::]’
/usr/include/boost/pfr/core.hpp:106:29:   required from ‘constexpr auto
boost::pfr::structure_to_tuple(const T&) [with T =
examples::ControlGallery::]’
/home/jcelerier/ossia/score/3rdparty/avendish/include/avnd/concepts/port.hpp:12:549:
  required from ‘struct avnd::inputs_type’
/home/jcelerier/ossia/score/3rdparty/avendish/include/avnd/concepts/processor.hpp:36:43:
  required from ‘constexpr const int
avnd::mono_sample_array_input_port_count’
/home/jcelerier/ossia/score/3rdparty/avendish/include/avnd/concepts/processor.hpp:60:8:
  required by substitution of ‘template  requires
(monophonic_audio_processor) && ((inputs_is_value) &&
(outputs_is_value)) struct avnd::effect_container [with T =
examples::ControlGallery]’
/home/jcelerier/ossia/score/3rdparty/avendish/include/avnd/binding/ossia/node.hpp:471:31:
  required from ‘class oscr::safe_node_base’
/home/jcelerier/ossia/score/3rdparty/avendish/include/avnd/binding/ossia/port_node.hpp:7:7:
  required from ‘class oscr::safe_node’
/tmp/av/build/examples__ControlGallery_ossia.cpp:11:25:   required from here
/usr/include/boost/pfr/detail/fields_count.hpp:243:17: internal compiler error:
in tsubst_copy_and_build, at cp/pt.c:19817
  243 | -> decltype(sizeof(T{}))
  | ^~~
0x16b7aa9 internal_error(char const*, ...)
???:0
0x63d391 fancy_abort(char const*, int, char const*)
???:0
0x69d25e fold_non_dependent_init(tree_node*, int, bool, tree_node*)
???:0
0x807e3d finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
???:0
0x7cd4ae tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x7ccc26 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x7dbe67 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0x66c809 build_new_function_call(tree_node*, vec**, int)
???:0
0x7f9c5c finish_call_expr(tree_node*, vec**, bool,
bool, int)
???:0
0x7dd8b0 instantiate_decl(tree_node*, bool, bool)
???:0
0xfbdbe2 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*))
???:0
0xfbddfa walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*))
???:0
0xfbed9c walk_tree_without_duplicates_1(tree_node**, tree_node*
(*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*,
tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*))
???:0
0x69cde4 maybe_constant_value(tree_node*, tree_node*, bool)
???:0
0x7cd689 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x7dd8b0 instantiate_decl(tree_node*, bool, bool)
???:0
0x6db023 mark_used(tree_node*, int)
???:0
0x66c81e build_new_function_call(tree_node*, vec**, int)
???:0
0x7f9c5c 

[Bug c++/103764] Global std::string constructor not called

2021-12-18 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103764

--- Comment #3 from Jean-Michaël Celerier  ---
Wops, sorry for the noise, forgot that shared libs were "executable"

[Bug c++/103764] New: Global std::string constructor not called

2021-12-18 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103764

Bug ID: 103764
   Summary: Global std::string constructor not called
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeanmichael.celerier at gmail dot com
  Target Milestone: ---

Repro:

foo.cpp: 

#include 

std::string my_global_string(100, 'x');

main.cpp:

#include 
#include 

extern std::string my_global_string;

int main() {
  std::cout << my_global_string << std::endl; 
}


Build:

$ g++ foo.cpp -shared -O3 -fPIC -o libfoo.so
$ g++ main.cpp -shared -O3 -fPIC -L$PWD -lfoo

Run: 

$ LD_LIBRARY_PATH=$PWD ./a.out
[1]66470 segmentation fault (core dumped)  ./a.out

Valgrind:

$ valgrind -s ./a.out 
==66587== Memcheck, a memory error detector
==66587== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==66587== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
==66587== Command: ./a.out
==66587== 
==66587== Invalid read of size 8
==66587==at 0x1090B5: main (in /tmp/a.out)
==66587==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
==66587== 
==66587== 
==66587== Process terminating with default action of signal 11 (SIGSEGV):
dumping core
==66587==  Access not within mapped region at address 0x8
==66587==at 0x1090B5: main (in /tmp/a.out)
==66587==  If you believe this happened as a result of a stack
==66587==  overflow in your program's main thread (unlikely but
==66587==  possible), you can try to increase the size of the
==66587==  main thread stack using the --main-stacksize= flag.
==66587==  The main thread stack size used in this run was 8388608.
==66587== 
==66587== HEAP SUMMARY:
==66587== in use at exit: 0 bytes in 0 blocks
==66587==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==66587== 
==66587== All heap blocks were freed -- no leaks are possible
==66587== 
==66587== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
==66587== 
==66587== 1 errors in context 1 of 1:
==66587== Invalid read of size 8
==66587==at 0x1090B5: main (in /tmp/a.out)
==66587==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
==66587== 
==66587== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
[1]66587 segmentation fault (core dumped)  valgrind -s ./a.out

[Bug c++/102990] New: ICE in tsubst_copy_and_build, à cp/pt.c:19856

2021-10-28 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102990

Bug ID: 102990
   Summary: ICE in tsubst_copy_and_build, à cp/pt.c:19856
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeanmichael.celerier at gmail dot com
  Target Milestone: ---

Created attachment 51695
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51695=edit
Source code that causes the ICE

Hello,

g++-11.1 (Arch Linux).

Here's the stack trace I'm getting:

$ g++  -fPIC -fcoroutines -std=gnu++20 -c out.cpp 
In file included from /usr/include/boost/pfr/detail/core17.hpp:11,
 from /usr/include/boost/pfr/detail/core.hpp:17,
 from /usr/include/boost/pfr/core.hpp:12,
 from /usr/include/boost/pfr.hpp:12,
 from
/home/jcelerier/projets/perso/avendish/src/avnd/concepts/generic.hpp:6,
 from
/home/jcelerier/projets/perso/avendish/src/avnd/concepts/audio_port.hpp:6,
 from
/home/jcelerier/projets/perso/avendish/src/avnd/concepts.hpp:6,
 from
/home/jcelerier/projets/perso/avendish/src/avnd/prepare.hpp:5,
 from
/home/jcelerier/projets/perso/avendish/src/avnd/avnd.hpp:5,
 from
/home/jcelerier/projets/perso/avendish/src/python/processor.hpp:5,
 from /tmp/sdfljifg/examples__Helpers_python.cpp:5:
/usr/include/boost/pfr/detail/fields_count.hpp: In substitution of
‘template constexpr decltype (sizeof (T{}))
boost::pfr::detail::detect_fields_count_dispatch(boost::pfr::detail::size_t_,
long int, int) [with T = examples::Helpers::;
long unsigned int N = ]’:
/usr/include/boost/pfr/detail/fields_count.hpp:243:78:   required from
‘constexpr std::size_t boost::pfr::detail::fields_count() [with T = const
examples::Helpers::; std::size_t = long
unsigned int]’
/usr/include/boost/pfr/detail/core17.hpp:54:54:   required from ‘constexpr
auto boost::pfr::detail::tie_as_tuple(T&) [with T = const
examples::Helpers::]’
/usr/include/boost/pfr/core.hpp:106:29:   required from ‘constexpr auto
boost::pfr::structure_to_tuple(const T&) [with T =
examples::Helpers::]’
/home/jcelerier/projets/perso/avendish/src/avnd/concepts/port.hpp:12:424:  
required from ‘struct avnd::inputs_type >’
   
/home/jcelerier/projets/perso/avendish/src/avnd/input_introspection.hpp:13:7:  
required by substitution of ‘template using
parameter_input_introspection = avnd::parameter_introspection::type> [with T = examples::Helpers]’
/home/jcelerier/projets/perso/avendish/src/python/processor.hpp:47:54:  
required from ‘python::processor::processor(pybind11::module_&) [with T =
examples::Helpers]’
/tmp/sdfljifg/examples__Helpers_python.cpp:10:52:   required from here
/usr/include/boost/pfr/detail/fields_count.hpp:189:17: internal compiler
error: in tsubst_copy_and_build, at cp/pt.c:19856
  189 | -> decltype(sizeof(T{}))
  | ^~~
0x1797368 internal_error(char const*, ...)
???:0
0x67f8f9 fancy_abort(char const*, int, char const*)
???:0
0x6be30e fold_non_dependent_init(tree_node*, int, bool, tree_node*)
???:0
0x816127 finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
???:0
0x7e78a9 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x7e721e tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x803139 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0x6994f5 build_new_function_call(tree_node*, vec**, int)
???:0
0x8177bc finish_call_expr(tree_node*, vec**,
bool, bool, int)
???:0
0x7ea4ef instantiate_decl(tree_node*, bool, bool)
???:0
0xfa14b3 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*))
???:0
0xfa16a0 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*))
???:0
0xfa37da walk_tree_without_duplicates_1(tree_node**, tree_node*
(*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*,
tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*))
???:0
0x6bdef4 maybe_constant_value(tree_node*, tree_node*, bool)
???:0
0x7e7c3a tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x7ea4ef instantiate_decl(tree_node*, bool, bool)
???:0
0x711996 mark_used(tree_node*, int)
???:0
0x69950a build_new_function_call(tree_node*, vec**, int)
???:0
   

[Bug libstdc++/42679] RTLD_DEEPBIND dlopen option for shared library that uses libstdc++ std::ostream crashes

2021-10-15 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42679

--- Comment #25 from Jean-Michaël Celerier  ---
My code is built with CMake with CMAKE_POSITION_INDEPENDENT_CODE set, which (I
double checked) correctly adds -fPIC to the link line.

[Bug libstdc++/42679] RTLD_DEEPBIND dlopen option for shared library that uses libstdc++ std::ostream crashes

2021-10-15 Thread jeanmichael.celerier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42679

Jean-Michaël Celerier  changed:

   What|Removed |Added

 CC||jeanmichael.celerier@gmail.
   ||com

--- Comment #24 from Jean-Michaël Celerier  ---
Hello, 
I am still hitting this exact bug with GCC 11.1: calling std::cout in a library
dlopen'd with RTLD_DEEPBIND causes a crash on sentry::sentry.

I also found another report here :

https://github.com/KhronosGroup/Vulkan-Loader/issues/433#issuecomment-658875808