public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102881] New: gcc totally broken when trailing return type combine with decltype lambda
@ 2021-10-21 13:56 hewillk at gmail dot com
2021-10-21 14:41 ` [Bug c++/102881] " hewillk at gmail dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2021-10-21 13:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102881
Bug ID: 102881
Summary: gcc totally broken when trailing return type combine
with decltype lambda
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
template<int N>
using R = decltype([] { return 0; }());
template <int N>
auto you_can_see_me() -> R<N> {
return {};
}
int main() {
you_can_see_me<0>();
}
GCC rejects with:
<source>:10:3: error: 'you_can_see_me' was not declared in this scope
10 | you_can_see_me<0>();
| ^~~~~~~~~~~~~~~~~
https://godbolt.org/z/7WEsjjscT
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/102881] gcc totally broken when trailing return type combine with decltype lambda
2021-10-21 13:56 [Bug c++/102881] New: gcc totally broken when trailing return type combine with decltype lambda hewillk at gmail dot com
@ 2021-10-21 14:41 ` hewillk at gmail dot com
2021-10-22 9:07 ` vanyacpp at gmail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2021-10-21 14:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102881
--- Comment #1 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to 康桓瑋 from comment #0)
> template<int N>
> using R = decltype([] { return 0; }());
>
> template <int N>
> auto you_can_see_me() -> R<N> {
> return {};
> }
>
> int main() {
> you_can_see_me<0>();
> }
>
> GCC rejects with:
>
> <source>:10:3: error: 'you_can_see_me' was not declared in this scope
> 10 | you_can_see_me<0>();
> | ^~~~~~~~~~~~~~~~~
>
> https://godbolt.org/z/7WEsjjscT
Even broken when there is no trailing return type:
#include <concepts>
template<class>
struct O {};
template<std::size_t>
using R = decltype([] { return O<int>{}; }());
template <int N>
constexpr R<N> get_variant() { return {}; }
static_assert(std::same_as<R<0>, O<int>>);
auto x = get_variant<0>();
static_assert(!std::same_as<decltype(x), O<int>>);
static_assert(std::same_as<decltype(x), int>);
https://godbolt.org/z/4bKccTEe5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/102881] gcc totally broken when trailing return type combine with decltype lambda
2021-10-21 13:56 [Bug c++/102881] New: gcc totally broken when trailing return type combine with decltype lambda hewillk at gmail dot com
2021-10-21 14:41 ` [Bug c++/102881] " hewillk at gmail dot com
@ 2021-10-22 9:07 ` vanyacpp at gmail dot com
2021-12-01 22:05 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: vanyacpp at gmail dot com @ 2021-10-22 9:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102881
Ivan Sorokin <vanyacpp at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vanyacpp at gmail dot com
--- Comment #2 from Ivan Sorokin <vanyacpp at gmail dot com> ---
PR92707 also features lambda inside decltype. Perhaps they are related.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/102881] gcc totally broken when trailing return type combine with decltype lambda
2021-10-21 13:56 [Bug c++/102881] New: gcc totally broken when trailing return type combine with decltype lambda hewillk at gmail dot com
2021-10-21 14:41 ` [Bug c++/102881] " hewillk at gmail dot com
2021-10-22 9:07 ` vanyacpp at gmail dot com
@ 2021-12-01 22:05 ` cvs-commit at gcc dot gnu.org
2021-12-01 22:55 ` ubizjak at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-01 22:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102881
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:
https://gcc.gnu.org/g:7eb961d83b0eda53aeb1cfaacdc367e1952de613
commit r12-5700-g7eb961d83b0eda53aeb1cfaacdc367e1952de613
Author: Uros Bizjak <ubizjak@gmail.com>
Date: Wed Dec 1 23:01:09 2021 +0100
i386: Improve V8HI and V8HF inserts [PR102811]
Introduce vec_set_0 pattern for V8HI and V8HF modes to implement scalar
element 0 inserts to from a GP register, SSE register or memory. Also
add V8HI and V8HF AVX2 (x,x,x) alternative to PINSR insn pattern, which is
split after reload to a sequence of PBROADCASTW and PBLENDW.
The V8HF inserts from memory improve from:
- vpbroadcastw 4(%esp), %xmm1
- vpblendw $16, %xmm1, %xmm0, %xmm0
+ vpinsrw $4, 4(%esp), %xmm0, %xmm0
and V8HF inserts from SSE register to element 0 improve from:
vpxor %xmm2, %xmm2, %xmm2
- vpbroadcastw %xmm0, %xmm0
vpblendw $1, %xmm0, %xmm2, %xmm0
Based on the above improvements, the register allocator is able to
determine
the optimal instruction (or instruction sequence) based on the register set
of the input value, so there is no need to manually expand V8HI and V8HF
inserts to the sequence of VEC_DUPLICATE and VEC_MERGE RTXes.
2021-12-01 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/102811
* config/i386/sse.md (VI2F): Remove mode iterator.
(VI2F_256_512): New mode iterator.
(vec_set<V8_128:mode>_0): New insn pattern.
(vec_set<VI2F_256_512:mode>_0>): Rename from
vec_set<VI2F:mode>mode.
Use VI2F_256_512 mode iterator instead of VI2F.
(*axv512fp16_movsh): Remove.
(<sse2p4_1>_pinsr<ssemodesuffix>): Add (x,x,x) AVX2 alternative.
Do not disable V8HF mode insn on AVX2 targets.
(pinsrw -> pbroadcast + pblendw peephole2): New peephole.
(pinsrw -> pbroadcast + pblendw splitter): New post-reload
splitter.
* config/i386/i386.md (extendhfsf): Call gen_vec_setv8hf_0.
* config/i386/i386-expand.c (ix86_expand_vector_set)
<case E_V8HFmode>: Use vec_merge path for TARGET_AVX2.
gcc/testsuite/ChangeLog:
PR target/102881
* gcc.target/i386/pr102811-1.c: New test.
* gcc.target/i386/avx512fp16-1c.c (dg-final): Update
scan-assembler-times scan strings for ia32 targets.
* gcc.target/i386/pr102327-1.c (dg-final): Ditto.
* gcc.target/i386/pr102811.c: Rename from ...
* gcc.target/i386/avx512vl-vcvtps2ph-pr102811.c: ... this.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/102881] gcc totally broken when trailing return type combine with decltype lambda
2021-10-21 13:56 [Bug c++/102881] New: gcc totally broken when trailing return type combine with decltype lambda hewillk at gmail dot com
` (2 preceding siblings ...)
2021-12-01 22:05 ` cvs-commit at gcc dot gnu.org
@ 2021-12-01 22:55 ` ubizjak at gmail dot com
2021-12-02 12:46 ` jakub at gcc dot gnu.org
2024-04-13 7:57 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2021-12-01 22:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102881
--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
> The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:
Oops, wrong PR number...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/102881] gcc totally broken when trailing return type combine with decltype lambda
2021-10-21 13:56 [Bug c++/102881] New: gcc totally broken when trailing return type combine with decltype lambda hewillk at gmail dot com
` (3 preceding siblings ...)
2021-12-01 22:55 ` ubizjak at gmail dot com
@ 2021-12-02 12:46 ` jakub at gcc dot gnu.org
2024-04-13 7:57 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-12-02 12:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102881
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems foo gets silently (because of tentative parser in
cp_parser_late_return_type_opt -> cp_parser_trailing_type_id ->
cp_parser_type_id_1 -> cp_parser_type_specifier_seq -> cp_parser_type_specifier
-> cp_parser_simple_type_specifier
19684 /* Don't gobble tokens or issue error messages if this is an
19685 optional type-specifier. */
19686 if (flags & CP_PARSER_FLAGS_OPTIONAL)
19687 cp_parser_parse_tentatively (parser);
) late_return of error_mark_node, and that then causes pushdecl not to happen
and so it isn't found. But getting lost in why the type specifier parsing
failed...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/102881] gcc totally broken when trailing return type combine with decltype lambda
2021-10-21 13:56 [Bug c++/102881] New: gcc totally broken when trailing return type combine with decltype lambda hewillk at gmail dot com
` (4 preceding siblings ...)
2021-12-02 12:46 ` jakub at gcc dot gnu.org
@ 2024-04-13 7:57 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13 7:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102881
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |14.0
Status|UNCONFIRMED |RESOLVED
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed for GCC 14 by the recent lambda template patches.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-13 7:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 13:56 [Bug c++/102881] New: gcc totally broken when trailing return type combine with decltype lambda hewillk at gmail dot com
2021-10-21 14:41 ` [Bug c++/102881] " hewillk at gmail dot com
2021-10-22 9:07 ` vanyacpp at gmail dot com
2021-12-01 22:05 ` cvs-commit at gcc dot gnu.org
2021-12-01 22:55 ` ubizjak at gmail dot com
2021-12-02 12:46 ` jakub at gcc dot gnu.org
2024-04-13 7:57 ` pinskia 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).