[Bug target/104890] [11 Regression] doesn't work with __attribute__((target ("general-regs-only"))) and -march=i686

2022-03-20 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104890

--- Comment #16 from H.J. Lu  ---
[hjl@gnu-skx-1 gcc]$ ./xgcc -B./ -O2 -m32  /tmp/x.c -S  -march=sapphirerapids 
-mshstk
In file included from ./include/x86gprintrin.h:45,
 from /tmp/x.c:1:
./include/cetintrin.h: In function ?_Unwind_Resume_or_Rethrow?:
./include/cetintrin.h:55:1: error: inlining failed in call to ?always_inline?
?_inc_ssp?: target specific option mismatch
   55 | _inc_ssp (unsigned int __B)
  | ^~~~
/tmp/x.c:7:3: note: called from here
7 |   _inc_ssp(1);
  |   ^~~
[hjl@gnu-skx-1 gcc]$ ./xgcc -B./ -O2 -m32  /tmp/x.c -S  -march=tigerlake
-mshstkIn file included from ./include/x86gprintrin.h:45,
 from /tmp/x.c:1:
./include/cetintrin.h: In function ?_Unwind_Resume_or_Rethrow?:
./include/cetintrin.h:55:1: error: inlining failed in call to ?always_inline?
?_inc_ssp?: target specific option mismatch
   55 | _inc_ssp (unsigned int __B)
  | ^~~~
/tmp/x.c:7:3: note: called from here
7 |   _inc_ssp(1);
  |   ^~~
[hjl@gnu-skx-1 gcc]$ ./xgcc -B./ -O2 -m32  /tmp/x.c -S  -march=alderlake
-mshstkIn file included from ./include/x86gprintrin.h:45,
 from /tmp/x.c:1:
./include/cetintrin.h: In function ?_Unwind_Resume_or_Rethrow?:
./include/cetintrin.h:55:1: error: inlining failed in call to ?always_inline?
?_inc_ssp?: target specific option mismatch
   55 | _inc_ssp (unsigned int __B)
  | ^~~~
/tmp/x.c:7:3: note: called from here
7 |   _inc_ssp(1);
  |   ^~~
[hjl@gnu-skx-1 gcc]$ ./xgcc -B./ -O2 -m32  /tmp/x.c -S  -march=cascadelake
-mshstk
[hjl@gnu-skx-1 gcc]$

[Bug target/104890] [11 Regression] doesn't work with __attribute__((target ("general-regs-only"))) and -march=i686

2022-03-20 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104890

H.J. Lu  changed:

   What|Removed |Added

 CC||crazylht at gmail dot com

--- Comment #15 from H.J. Lu  ---
[hjl@gnu-skx-1 gcc]$ cat /tmp/x.c
#include 

__attribute__((target("no-mmx,no-sse")))
void
_Unwind_Resume_or_Rethrow(void) 
{
  _inc_ssp(1);
}
[hjl@gnu-skx-1 gcc]$ ./xgcc -B./ -O2 -m32  /tmp/x.c -S  -march=tigerlake
In file included from ./include/x86gprintrin.h:45,
 from /tmp/x.c:1:
./include/cetintrin.h: In function ?_Unwind_Resume_or_Rethrow?:
./include/cetintrin.h:55:1: error: inlining failed in call to ?always_inline?
?_inc_ssp?: target specific option mismatch
   55 | _inc_ssp (unsigned int __B)
  | ^~~~
/tmp/x.c:7:3: note: called from here
7 |   _inc_ssp(1);
  |   ^~~
[hjl@gnu-skx-1 gcc]$

[Bug target/104977] [avx512fp16] wrong code for vfmaddcsh when -masm=intel.

2022-03-20 Thread wwwhhhyyy333 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104977

--- Comment #3 from Hongyu Wang  ---
Fixed for GCC 12.

[Bug target/104977] [avx512fp16] wrong code for vfmaddcsh when -masm=intel.

2022-03-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104977

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Hongyu Wang :

https://gcc.gnu.org/g:e767da23de12ceb1bf3aece4dae0ae20bf605b04

commit r12-7730-ge767da23de12ceb1bf3aece4dae0ae20bf605b04
Author: Hongyu Wang 
Date:   Fri Mar 18 23:47:35 2022 +0800

AVX512FP16: Fix masm=intel output for vfc?(madd|mul)csh [PR 104977]

Fix typo in subst for scalar complex mask_round operand.

gcc/ChangeLog:

PR target/104977
* config/i386/sse.md
   
(avx512fp16_fmash_v8hf):
Correct round operand for intel dialect.

gcc/testsuite/ChangeLog:

PR target/104977
* gcc.target/i386/pr104977.c: New test.

[Bug middle-end/104975] ICE in execute, at gimple-harden-conditionals.cc:577 and returns_twice and pure attributes on the same function

2022-03-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104975

Andrew Pinski  changed:

   What|Removed |Added

  Component|tree-optimization   |middle-end
Summary|ICE in execute, at  |ICE in execute, at
   |gimple-harden-conditionals. |gimple-harden-conditionals.
   |cc:577 and returns_twice|cc:577 and returns_twice
   ||and pure attributes on the
   ||same function
   Keywords|ice-on-valid-code   |

--- Comment #1 from Andrew Pinski  ---
I don't know if this is exactly valid.
pure/const and returns_twice does not make sense together really.
One/Both of the attributes should be ignored.

[Bug c++/104995] access checking for function pointer template parameters takes place at call site

2022-03-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104995

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||c++-lambda

--- Comment #1 from Andrew Pinski  ---
Confirmed.

[Bug c++/104995] New: access checking for function pointer template parameters takes place at call site

2022-03-20 Thread mawww at kakoune dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104995

Bug ID: 104995
   Summary: access checking for function pointer template
parameters takes place at call site
   Product: gcc
   Version: 11.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mawww at kakoune dot org
  Target Milestone: ---

The following code

```
template
void func() {
auto lambda = [&](auto&& s) { F(s); };
lambda(0);
}

struct S {
void f() { func(); }

private:
static void g(int) {}
};
```

Fails to compile on g++ 11.2.1 with the following error:

```
test.cc: In instantiation of ‘func():: [with auto:1 =
int]’:
test.cc:4:11:   required from ‘void func() [with auto F = S::g]’
test.cc:8:26:   required from here
test.cc:3:36: error: ‘static void S::g(int)’ is private within this context
3 | auto lambda = [&](auto&& s) { F(s); };
  |   ~^~~
test.cc:11:17: note: declared private here
   11 | static void g(int) {}
  | ^

```

Clang accepts this code, making func's body just `{ F(0); }` compiles without
errors as well.

[Bug rtl-optimization/104985] [12 Regression] ICE: SIGSEGV in undo_to_marker / adjust_reg_mode with -Os -frounding-math

2022-03-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104985

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |12.0

[Bug libstdc++/104990] [12 Regression] std::get_time is incompatible with clang 14

2022-03-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104990

--- Comment #4 from Andrew Pinski  ---
>This showed up with -fgnuc-version=11.2 on the command line to work around 
>code doing broken things like in the particular code being compiled.

Why not fix that code instead of having libstdc++ workaround a feature not
existing in clang when you specify the version.

In fact I think it is bad that __GNUC__ is even defined for clang in the first
place.

[Bug libstdc++/104990] [12 Regression] std::get_time is incompatible with clang 14

2022-03-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104990

--- Comment #3 from Andrew Pinski  ---
>This showed up with -fgnuc-version=11.2

Well then this is a bug in clang for allowing this really. libstdc++ uses
extensions based on the GNUC++ version and you specify that it was the wrong
version of GCC.

[Bug c++/104994] New: extern thread_local declaration rejected in constexpr

2022-03-20 Thread hstong at ca dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104994

Bug ID: 104994
   Summary: extern thread_local declaration rejected in constexpr
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: rejects-valid
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hstong at ca dot ibm.com
  Target Milestone: ---

GCC rejects block-scope extern declarations with the `thread_local` keyword in
constexpr bodies. The relevant wording (prior to removal by P2242
) prohibits only definitions.


### SOURCE ():
constexpr void f() {
  extern thread_local int x;
}


### COMPILER INVOCATION:
g++ -fsyntax-only -std=c++20 -xc++ -


### ACTUAL OUTPUT:
: In function 'constexpr void f()':
:2:27: error: 'x' declared 'thread_local' in 'constexpr' function only
available with '-std=c++2b' or '-std=gnu++2b'


### EXPECTED OUTPUT:
Clean compile.


### COMPILER VERSION INFO (g++ -v):
Using built-in specs.
COLLECT_GCC=/opt/wandbox/gcc-head/bin/g++
COLLECT_LTO_WRAPPER=/opt/wandbox/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../source/configure --prefix=/opt/wandbox/gcc-head
--enable-languages=c,c++ --disable-multilib --without-ppl --without-cloog-ppl
--enable-checking=release --disable-nls --enable-lto
LDFLAGS=-Wl,-rpath,/opt/wandbox/gcc-head/lib,-rpath,/opt/wandbox/gcc-head/lib64,-rpath,/opt/wandbox/gcc-head/lib32
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220319 (experimental) (GCC)

[Bug target/100641] Link error when using extern thread_local variables on AIX

2022-03-20 Thread hstong at ca dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100641

Hubert Tong  changed:

   What|Removed |Added

 CC||hstong at ca dot ibm.com

--- Comment #2 from Hubert Tong  ---
This was addressed in Clang last year. The AIX linker does not have the same
weak reference semantics as some other linkers. The means that the TLS init
function needs to be defined by the object file containing the definition of
the `thread_local` variable if the language semantics does not make it so that
all potential references occur in contexts where it is known that the
initialization/finalization is constant.

[Bug c++/104924] bad_variant_access When using iostream and variant as modules

2022-03-20 Thread yunior.eury at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104924

--- Comment #3 from Lorenzo Gomez  ---
(In reply to Andrew Pinski from comment #1)
> C++ modules in GCC 11 (and it looks like 12 but some bugs have been fixed
> there) is still considered experimental and your mileage on this feature
> will varry.
> 
> Note I have not checked to see if this has been fixed on the trunk for GCC
> 12.

Would like to report that I attempted to compile the same example on `gcc (GCC)
12.0.1 20220313 (experimental)` and it looks it has not been fixed yet.
Hopefully it gets fixed soon.

[Bug tree-optimization/104992] [missed optimization] x / y * y == x not optimized to x % y == 0

2022-03-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104992

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Keywords||missed-optimization

[Bug fortran/104570] [12 Regression] ICE in gfc_conv_scalarized_array_ref, at fortran/trans-array.cc:3681 since r12-7217-g57da34939703a6e6

2022-03-20 Thread mikael at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104570

Mikael Morin  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #5 from Mikael Morin  ---
Fixed.

[Bug c++/104993] New: [modules] Missing diagnostic when exporting using-directive

2022-03-20 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104993

Bug ID: 104993
   Summary: [modules] Missing diagnostic when exporting
using-directive
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: diagnostic
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: johelegp at gmail dot com
  Target Milestone: ---

[module.interface]p3s1 says
> An exported declaration that is not a module-import-declaration shall declare 
> at least one name.
And its following example includes the line
> `export using namespace N;   // error: does not declare a name`
https://godbolt.org/z/aGY9b6x66 shows Clang give a warning.
> mod.cpp:3:38: warning: ISO C++20 does not permit using directive to be 
> exported [-Wexport-using-directive]
> export namespace y { using namespace x; }
> ^
> 1 warning generated.
GCC is silent: https://godbolt.org/z/zP6648s46.

Source:
```C++
export module mod;
export namespace x { int y; }
export namespace y { using namespace x; }
```

[Bug tree-optimization/104992] New: [missed optimization] x / y * y == x not optimized to x % y == 0

2022-03-20 Thread tilkax at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104992

Bug ID: 104992
   Summary: [missed optimization] x / y * y == x not optimized to
x % y == 0
   Product: gcc
   Version: 11.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tilkax at gmail dot com
  Target Milestone: ---

This is especially helpful for constant y because checking
division-by-a-constant remainders against zero allows further optimization.

Repro case:

unsigned foo(unsigned x, unsigned y)
{
return x / y * y == x;
}

GCC -O3:
mov eax, edi
xor edx, edx
div esi
mov eax, edi
sub eax, edx
cmp eax, edi
seteal
movzx   eax, al
ret

Clang -O3:
mov eax, edi
xor edx, edx
div esi
xor eax, eax
testedx, edx
seteal
ret

[Bug rtl-optimization/104869] [12 Regression] Miscompilation of qt5-qtdeclarative since r12-6342-ge7a7dbb5ca5dd696

2022-03-20 Thread rsandifo at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104869

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rsandifo at gcc dot 
gnu.org

--- Comment #4 from rsandifo at gcc dot gnu.org  
---
Mine.  The problem is in function_info::make_use_available,
which doesn't cope correctly with cases in which the start
of the BB comes “between” two clobbers (in an RPO sense).

[Bug libstdc++/104990] [12 Regression] std::get_time is incompatible with clang 14

2022-03-20 Thread bero at lindev dot ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104990

--- Comment #2 from Bernhard Rosenkraenzer  ---
clang's __GNUC__ defines depend on a command line -fgnuc-version=

This showed up with -fgnuc-version=11.2 on the command line to work around code
doing broken things like in the particular code being compiled.

#if __GNUC__ > 5
// do something sane
#else
// insane workaround because gcc 4.x was missing features
// both gcc and clang have these days
#endif

So probably only few people will run into this -- but it's probably worth
changing

#if __GNUC__ >= 5

to

#if __GNUC__ >= 5 && !defined(__clang__)

(or alternatively adding the extension to clang).

[Bug libstdc++/104990] [12 Regression] std::get_time is incompatible with clang 14

2022-03-20 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104990

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
How is that possible?
This code is guarded with
#if __GNUC__ >= 5
because it is using a GCC extension which ICC also supports.
AFAIK clang predefines __GNUC__ as 4 and __GNUC_MINOR__ as 2.

[Bug c++/103871] [11/12 Regression] co_await causes build error

2022-03-20 Thread sks_f at mail dot ru via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103871

Konstantin  changed:

   What|Removed |Added

 CC||sks_f at mail dot ru

--- Comment #7 from Konstantin  ---
Confirm, bug exist in 11.2.1. Would be nice if will be fixed in 11.3.

[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668

2022-03-20 Thread sks_f at mail dot ru via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056

Konstantin  changed:

   What|Removed |Added

 CC||sks_f at mail dot ru

--- Comment #17 from Konstantin  ---
Bug still exist in 11.2.1:

/ClientHandshake.cpp:64:1: error: array used as initializer

compiler fails on line:

co_await writer().all({ AS_BYTE(m_sessionType), id });

[Bug target/104991] New: [nvptx] Simplify muniform-simt transformation

2022-03-20 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104991

Bug ID: 104991
   Summary: [nvptx] Simplify muniform-simt transformation
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

The muniform-simt reorg pass transforms the insn stream, both inside and
outside an SIMT region.

The transform rewrites atomic insns by adding a predicate to execute in one
thread only outside the SIMT region.  Furthermore, if the atomic insn has a
result, a shuffle is added to propagate the result to all threads in the warp.

Inside the SIMT region, the predicate evaluates to true such that all threads
in the warp execute it.

And the source lane register for the shuffle is set such that the shuffle is a
nop inside the SIMT region.

However, since we've started using shfl.sync for the shuffle, the shuffle now
has it's own predicate, and consequently having a source lane register with
different values inside and outside the SIMT region is no longer necessary.

[Bug libstdc++/104990] New: [12 Regression] std::get_time is incompatible with clang 14

2022-03-20 Thread bero at lindev dot ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104990

Bug ID: 104990
   Summary: [12 Regression] std::get_time is incompatible with
clang 14
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bero at lindev dot ch
  Target Milestone: ---

This sample code:


#include 
#include 

int main(int argc, char **argv) {
std::tm tm = {};
std::stringstream ss("2022-03-18 01:02:03");
ss >>std::get_time(, "%Y-%m-%d %H:%M:%S");
std::cout << std::asctime();
}


works perfectly when built with gcc 12.0, or when built with clang 14 using
libc++ or libstdc++ versions prior to 12.0 -- but when using clang with
libstdc++ 12.0 (20220313 snapshot), it results in

In file included from test.cc:1:
In file included from
/usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/12.0.0/../../../../include/c++/12.0.0/iomanip:43:
In file included from
/usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/12.0.0/../../../../include/c++/12.0.0/locale:41:
In file included from
/usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/locale_facets_nonio.h:2069:
/usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/locale_facets_nonio.tcc:1477:18:
error: reference to non-static member function must be called
  if ((void*)(this->*(_get::do_get)) == (void*)(_get::do_get))
 ^~~~
/usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/12.0.0/../../../../include/c++/12.0.0/iomanip:433:20:
note: in instantiation of member function 'std::time_get::get' requested
here
  __mg.get(_Iter(__is.rdbuf()), _Iter(), __is,
   ^
test.cc:7:5: note: in instantiation of function template specialization
'std::operator>>>' requested here
ss >>std::get_time(, "%Y-%m-%d %H:%M:%S");
   ^
1 error generated.