[Bug c++/109283] Destructor of co_yield conditional argument called twice

2024-05-25 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109283

--- Comment #6 from accelerator0099 at gmail dot com ---
Still ICEs in truck
commit 28b508233a12c13295f960a2cb8a4864879acfb4
May 25 2024
version 15.0.0

Output:
co_yield_bug.cc:197:31: error: redefinition of default argument for ‘class
_Alloc’
  197 | template >
  |   ^
In file included from /build/gcc/include/c++/15.0.0/ranges:72,
 from co_yield_bug.cc:17:
/build/gcc/include/c++/15.0.0/bits/elements_of.h:55:26: note: original
definition appeared here
   55 |   template>
  |  ^~~~
co_yield_bug.cc:204:9: error: redefinition of ‘template std::ranges::elements_of(_Rng&&, _Alloc)-> elements_of<_Range&&,
_Alloc>’
  204 | elements_of(_Rng&&, _Alloc = {}) -> elements_of<_Rng&&,
_Alloc>;
  | ^~~
/build/gcc/include/c++/15.0.0/bits/elements_of.h:63:5: note: ‘template std::ranges::elements_of(_Range&&, _Alloc)->
elements_of<_Range&&, _Alloc>’ previously declared here
   63 | elements_of(_Range&&, _Alloc = _Alloc())
  | ^~~
co_yield_bug.cc: In function ‘std::generator >
source(int&, std::string)’:
co_yield_bug.cc:513:1: internal compiler error: in flatten_await_stmt, at
cp/coroutines.cc:2875
  513 | }
  | ^
0x76fd99 flatten_await_stmt
/build/git/gcc/gcc/cp/coroutines.cc:2875
0xac4833 flatten_await_stmt
/build/git/gcc/gcc/cp/coroutines.cc:2904
0xac67d0 maybe_promote_temps
/build/git/gcc/gcc/cp/coroutines.cc:3087
0xac67d0 await_statement_walker
/build/git/gcc/gcc/cp/coroutines.cc:3726
0x169330c 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 >*))
/build/git/gcc/gcc/tree.cc:11468
0xac74e1 await_statement_walker
/build/git/gcc/gcc/cp/coroutines.cc:3546
0x169330c 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 >*))
/build/git/gcc/gcc/tree.cc:11468
0xac6528 await_statement_walker
/build/git/gcc/gcc/cp/coroutines.cc:3397
0x169330c 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 >*))
/build/git/gcc/gcc/tree.cc:11468
0xac69d0 await_statement_walker
/build/git/gcc/gcc/cp/coroutines.cc:3386
0x169330c 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 >*))
/build/git/gcc/gcc/tree.cc:11468
0xac69d0 await_statement_walker
/build/git/gcc/gcc/cp/coroutines.cc:3386
0x169330c 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 >*))
/build/git/gcc/gcc/tree.cc:11468
0xac6528 await_statement_walker
/build/git/gcc/gcc/cp/coroutines.cc:3397
0x169330c 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 >*))
/build/git/gcc/gcc/tree.cc:11468
0x1693464 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 >*))
/build/git/gcc/gcc/tree.cc:11702
0xac6528 await_statement_walker
/build/git/gcc/gcc/cp/coroutines.cc:3397
0x169330c 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 >*))
/build/git/gcc/gcc/tree.cc:11468
0xac69d0 await_statement_walker
/build/git/gcc/gcc/cp/coroutines.cc:3386
0x169330c 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 >*))
/build/git/gcc/gcc/tree.cc:11468

[Bug c++/109283] Destructor of co_yield conditional argument called twice

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

accelerator0099 at gmail dot com changed:

   What|Removed |Added

 CC||accelerator0099 at gmail dot 
com

--- Comment #5 from accelerator0099 at gmail dot com ---
(In reply to Jonathan Wakely from comment #4)
> (In reply to ncm from comment #3)
> > Appears fixed in 13.1
> 
> It's likely that it's not fixed, it's just that the release branches do not
> have as many consistency checks and assertions enabled as trunk does.
> 
> > 
> > Still ICEs in trunk,
> > Compiler-Explorer-Build-gcc-70d038235cc91ef1ea4fce519e628cfb2d297bff-
> > binutils-2.40) 14.0.0 20230508 (experimental):
> > : In function 'std::generator >
> > source(int&, std::string)':
> > :513:1: internal compiler error: in flatten_await_stmt, at
> > cp/coroutines.cc:2899
> >   513 | }
> 
> Confirmed.

Was that fixed in 14.1? I can compile with 14.1 and run with no error

[Bug c++/103909] coroutines: co_yield of aggregate-initialized temporaries leads to segmentation faults.

2024-05-06 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103909

accelerator0099 at gmail dot com changed:

   What|Removed |Added

 CC||accelerator0099 at gmail dot 
com

--- Comment #5 from accelerator0099 at gmail dot com ---
No error on GCC 13.2

[Bug c++/104384] coroutines: Heap corruption when initializing struct with co_await

2024-05-06 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104384

accelerator0099 at gmail dot com changed:

   What|Removed |Added

 CC||accelerator0099 at gmail dot 
com

--- Comment #2 from accelerator0099 at gmail dot com ---
No error on GCC 13.2

[Bug c++/107288] coroutines: Double-free of temporaries created in statement following co_await

2024-05-06 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107288

accelerator0099 at gmail dot com changed:

   What|Removed |Added

 CC||accelerator0099 at gmail dot 
com

--- Comment #4 from accelerator0099 at gmail dot com ---
No error on GCC 13.2

[Bug target/113560] Strange code generated when optimizing a multiplication on x86_64

2024-01-24 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113560

--- Comment #5 from accelerator0099 at gmail dot com ---
If we are using an arch without BMI2, we can use single MUL instruction
instead. Here is the description of MUL reg64/mem64.
Multiplies a 64-bit register or memory operand by the contents of the RAX
register and stores the result in the RDX:RAX register.
It stores the result in RDX:RAX, putting the high-order bits of the product in
RDX.
And on zen4 arch, it costs 3 or 4 circles to do this.

[Bug target/113560] Strange code generated when optimizing a multiplication on x86_64

2024-01-24 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113560

--- Comment #4 from accelerator0099 at gmail dot com ---
Well, I hope gcc will just generate mulx instruction on arch with BMI2. Let's
look at the AMD64 Architecture Programmer’s Manual Volume 3:
Computes the unsigned product of the specified source operand and the implicit
source operand rDX.
Writes the upper half of the product to the first destination and the lower
half to the second.
So, just a mulx can do this. And according to the manual, it only costs 3 or 4
circles to excute a mulx.

[Bug c++/113560] New: Strange code generated when optimizing a multiplication on x86_64

2024-01-23 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113560

Bug ID: 113560
   Summary: Strange code generated when optimizing a
multiplication on x86_64
   Product: gcc
   Version: 13.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: accelerator0099 at gmail dot com
  Target Milestone: ---

Code:
#include 
auto f(char *buf, unsigned long long in) noexcept
{
unsigned long long hi{};
auto lo{_mulx_u64(in, 0x2af31dc462ull, )};
lo = _mulx_u64(lo, 100, );
__builtin_memcpy(buf + 2, , 2);
return buf + 10;
}
auto g(char *buf, unsigned long long in) noexcept
{
unsigned long long hi{};
_mulx_u64(in, 100, );
__builtin_memcpy(buf + 2, , 2);
return buf + 10;
}

Compile with:
-Ofast -std=c++23 -march=znver4

GCC 13.2 and truck generate:
f(char*, unsigned long long):
movabs  rdx, 184467440738
mov rax, rdi
mulxr9, r8, rsi
xor r9d, r9d
mov rsi, r8
mov rdi, r9
add rsi, r8
shldrdi, r8, 1
add rsi, r8
adc rdi, r9
shldrdi, rsi, 3
sal rsi, 3
add rsi, r8
adc rdi, r9
add rax, 10
shldrdi, rsi, 2
mov WORD PTR [rax-8], di
ret
g(char*, unsigned long long):
mov eax, 100
mul rsi
lea rax, [rdi+10]
mov WORD PTR [rdi+2], dx
ret

GCC 12 generates:
f(char*, unsigned long long):
movabs  rdx, 184467440738
mov rax, rsi
imulrax, rdx
mov edx, 100
mulxrdx, rax, rax
lea rax, [rdi+10]
mov WORD PTR [rdi+2], dx
ret
g(char*, unsigned long long):
mov eax, 100
mul rsi
lea rax, [rdi+10]
mov WORD PTR [rdi+2], dx
ret

Clang:
f(char*, unsigned long long):
unsigned long long)
movabs  rdx, 184467440738
mov eax, 100
imulrdx, rsi
mulxrax, rax, rax
mov word ptr [rdi + 2], ax
lea rax, [rdi + 10]
ret
g(char*, unsigned long long):
unsigned long long)
mov eax, 100
mov rdx, rsi
mulxrax, rax, rax
mov word ptr [rdi + 2], ax
lea rax, [rdi + 10]
ret

See also:
https://gcc.godbolt.org/z/df7Gr1MKo

[Bug c++/113142] New: ICE in reference_binding, at cp/call.cc:2020

2023-12-25 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113142

Bug ID: 113142
   Summary: ICE in reference_binding, at cp/call.cc:2020
   Product: gcc
   Version: 13.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: accelerator0099 at gmail dot com
  Target Milestone: ---

Created attachment 56941
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56941=edit
gcc output and preprocessed source

g++ -std=c++20 main.cpp -c

[Bug c++/102098] ICE when #include with -fmodules-ts -std=c++20 since r11-7530-g1e5cdb9f896fb220

2023-08-05 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102098

Devourer Station  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Devourer Station  ---
Confirmed fixed in 13.1.1

[Bug c++/103524] [meta-bug] modules issue

2023-08-05 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
Bug 103524 depends on bug 102098, which changed state.

Bug 102098 Summary: ICE when #include  with -fmodules-ts 
-std=c++20 since r11-7530-g1e5cdb9f896fb220
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102098

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug c++/102098] ICE when #include with -fmodules-ts -std=c++20 since r11-7530-g1e5cdb9f896fb220

2023-08-05 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102098

--- Comment #7 from Devourer Station  ---
Confirmed solved in 13.1.1

[Bug c++/106584] g++ not showing correct line number in "use of deleted function" error

2022-08-12 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106584

--- Comment #5 from Devourer Station  ---
(In reply to Andrew Pinski from comment #4)
> Actually clang references the call:
> f(cl);
> 
> When it comes to the copy constructor.

At least it tells you about where the error is, otherwise you may fall into
thousands of lines of source code without knowing where to edit

[Bug c++/106584] g++ not showing correct line number in "use of deleted function" error

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

--- Comment #2 from Devourer Station  ---
Created attachment 53437
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53437=edit
compiler's output

[Bug c++/106584] g++ not showing correct line number in "use of deleted function" error

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

--- Comment #1 from Devourer Station  ---
Created attachment 53436
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53436=edit
Preprocessed source file

compile with g++ example.cpp -c

[Bug c++/106584] New: g++ not showing correct line number in "use of deleted function" error

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

Bug ID: 106584
   Summary: g++ not showing correct line number in "use of deleted
function" error
   Product: gcc
   Version: 12.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: accelerator0099 at gmail dot com
  Target Milestone: ---

Example code:

#include 
#include 

using int_map = std::map>;

void f(int_map cl);

void f2() {
int_map cl;
f(cl);
}


The actual error is that int_map is not copiable, so line 10 is ill-formed
But the compiler doesn't tell you anything about line 10, it just prints tons
of waste

This is unreasonable. You may make such a careless mistake (missing a '&') in
thousands of lines, the compiler should locate where the error is for you.

[Bug c++/102098] ICE when #include with -fmodules-ts -std=c++20 since r11-7530-g1e5cdb9f896fb220

2022-05-30 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102098

--- Comment #6 from Devourer Station  ---
Still exists with 11.2.0

[Bug c++/102098] ICE when #include with -fmodules-ts -std=c++20 since r11-7530-g1e5cdb9f896fb220

2021-08-31 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102098

--- Comment #5 from Devourer Station  ---
(In reply to Martin Liška from comment #1)
> Please attach the source files..

I'm sorry that the attachment suddenly went missing.
I reattached it.

[Bug c++/102098] ICE when #include with -fmodules-ts -std=c++20 since r11-7530-g1e5cdb9f896fb220

2021-08-31 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102098

--- Comment #4 from Devourer Station  ---
Created attachment 51388
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51388=edit
preprocessed source file (xz compressed)

preprocessed source file (xz compressed)

[Bug c/102098] New: ICE when #include with -fmodules-ts -std=c++20

2021-08-27 Thread accelerator0099 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102098

Bug ID: 102098
   Summary: ICE when #include  with -fmodules-ts
-std=c++20
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: accelerator0099 at gmail dot com
  Target Milestone: ---

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (GCC)

System:
Linux 5.13.12

Command:
g++ -std=c++20 -fmodules-ts -Wall -c broadcast_server.cc -save-temps

Sources:
Attached below

Output:
broadcast_server.cc:3:8: internal compiler error: in tree_node, at
cp/module.cc:9057
3 | export module broadcast_server;
  |^
0x1797368 internal_error(char const*, ...)
???:0
0x67f8f9 fancy_abort(char const*, int, char const*)
???:0
0x765323 trees_out::core_vals(tree_node*)
???:0
0x768e78 trees_out::tree_value(tree_node*)
???:0
0x761e9c trees_out::tree_node(tree_node*)
???:0
0x765323 trees_out::core_vals(tree_node*)
???:0
0x768e78 trees_out::tree_value(tree_node*)
???:0
0x761e9c trees_out::tree_node(tree_node*)
???:0
0x765323 trees_out::core_vals(tree_node*)
???:0
0x768e78 trees_out::tree_value(tree_node*)
???:0
0x761e9c trees_out::tree_node(tree_node*)
???:0
0x765323 trees_out::core_vals(tree_node*)
???:0
0x768e78 trees_out::tree_value(tree_node*)
???:0
0x761e9c trees_out::tree_node(tree_node*)
???:0
0x765323 trees_out::core_vals(tree_node*)
???:0
0x768e78 trees_out::tree_value(tree_node*)
???:0
0x761e9c trees_out::tree_node(tree_node*)
???:0
0x765323 trees_out::core_vals(tree_node*)
???:0
0x768e78 trees_out::tree_value(tree_node*)
???:0
0x761e9c trees_out::tree_node(tree_node*)
???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.


As you can see, there are "???:0"s instead of sources and line numbers.
Maybe the gcc on my os doesn't comtain debug information.

Do I need to rebuild it with debug enabled?