[Bug rtl-optimization/97459] __uint128_t remainder for division by 3

2020-10-25 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97459

Thomas Koenig  changed:

   What|Removed |Added

  Attachment #49438|divisiontable.dat   |divisiontable.txt
   filename||

--- Comment #13 from Thomas Koenig  ---
Comment on attachment 49438
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49438
Numbers a, b so that 2^b  ≡ 1 mod a up to b=64, larger b taken if several
solutions exist

Seems the bugzilla system decided this was an MPEG file.

Well, it is not, hopefully renaming it as txt will help.

[Bug ipa/97575] [11 Regression] ICE in try_make_edge_direct_simple_call, at ipa-prop.c:3671 or in propagate_controlled_uses, at ipa-prop.c:4073

2020-10-25 Thread asolokha at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97575

Arseny Solokha  changed:

   What|Removed |Added

Summary|[11 Regression] ICE in  |[11 Regression] ICE in
   |try_make_edge_direct_simple |try_make_edge_direct_simple
   |_call, at ipa-prop.c:3671   |_call, at ipa-prop.c:3671
   ||or in
   ||propagate_controlled_uses,
   ||at ipa-prop.c:4073

--- Comment #1 from Arseny Solokha  ---
Something that looks like a related issue, hence reported here instead of
filing a new PR.

% gcc-11.0.0 -Os -fopenacc -c gcc/testsuite/gcc.dg/pr51012-1.c
during IPA pass: inline
gcc/testsuite/gcc.dg/pr51012-1.c:17:1: internal compiler error: in
propagate_controlled_uses, at ipa-prop.c:4073
   17 | }
  | ^
0x677dc7 propagate_controlled_uses
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-prop.c:4073
0x677dc7 ipa_propagate_indirect_call_infos(cgraph_edge*, vec*)
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-prop.c:4135
0xb9bd5c inline_call(cgraph_edge*, bool, vec*,
int*, bool, bool*)
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-inline-transform.c:502
0x17d5bb2 inline_small_functions
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-inline.c:2242
0x17d5bb2 ipa_inline
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-inline.c:2723
0x17d5bb2 execute
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-inline.c:3122

[Bug ipa/97575] New: [11 Regression] ICE in try_make_edge_direct_simple_call, at ipa-prop.c:3671

2020-10-25 Thread asolokha at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97575

Bug ID: 97575
   Summary: [11 Regression] ICE in
try_make_edge_direct_simple_call, at ipa-prop.c:3671
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: asolokha at gmx dot com
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

g++-11.0.0-alpha20201025 snapshot (g:308e40331f9d2820f8286769b5fc764671187364)
ICEs when compiling the following testcase w/ -Os -fopenacc:

template 
struct db;

template 
struct db
{
  typedef WM 
};

template 
struct zg
{
  typename db::k3
  operator* ();
};

int
fq (int);

template 
void
ri (TT k2, HA t0)
{
  *k2 = t0 (0);
}

void
ai (zg pb)
{
  ri (pb, fq);
}

% g++-11.0.0 -Os -fopenacc -c w6shyynz.cc
during IPA pass: inline
w6shyynz.cc:31:1: internal compiler error: in try_make_edge_direct_simple_call,
at ipa-prop.c:3671
   31 | }
  | ^
0x73eaf7 try_make_edge_direct_simple_call
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-prop.c:3671
0x73eaf7 update_indirect_edges_after_inlining
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-prop.c:3880
0x73eaf7 propagate_info_to_inlined_callees
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-prop.c:3974
0xe32fe3 ipa_propagate_indirect_call_infos(cgraph_edge*, vec*)
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-prop.c:4136
0xe0ae2c inline_call(cgraph_edge*, bool, vec*,
int*, bool, bool*)
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-inline-transform.c:502
0x1a3d272 inline_small_functions
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-inline.c:2242
0x1a3d272 ipa_inline
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-inline.c:2723
0x1a3d272 execute
   
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20201025/work/gcc-11-20201025/gcc/ipa-inline.c:3122

[Bug bootstrap/97124] ICE when bootstrapping GCC on x86_64-w64-mingw32

2020-10-25 Thread lh_mouse at 126 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97124

--- Comment #6 from Liu Hao  ---
Today I got the same ICE when building mingw-w64. I am not clear why this error
only happened with GCC previously.

[Bug analyzer/97568] -fanalyzer assumes that an extern const pointer is NULL

2020-10-25 Thread vincent-gcc at vinc17 dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97568

--- Comment #1 from Vincent Lefèvre  ---
The bug has been introduced by commit af66094d037793773eb8a49597866457f2f6a104.

[Bug c++/97569] Declaring a struct in a field declaration of another struct. gcc and clang difference.

2020-10-25 Thread anders.granlund.0 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97569

--- Comment #2 from Anders Granlund  ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to Anders Granlund from comment #0)
> > The interesting thing is that if we replace  struct S  with  struct S {} 
> > both compilers agree on rejecting the program.
> 
> I don't see any struct S in the example program.

struct B  it should be.

[Bug c++/97574] New: Allow for nul output with Windows

2020-10-25 Thread svnpenn at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97574

Bug ID: 97574
   Summary: Allow for nul output with Windows
   Product: gcc
   Version: 10.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: svnpenn at gmail dot com
  Target Milestone: ---

Allow for nul output with Windows

A project I am trying to compile has this command:

cc -xc++ -o/dev/null -lc++ -shared

However I am using PowerShell, which has no notion of `/dev/null`:

PS C:\> cc -xc++ -o/dev/null -lc++ -shared
C:/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../
x86_64-w64-mingw32/bin/ld.exe: cannot open output file /dev/null.exe: No
such file or directory

I tried using `-o$null`, but it just creates a file `$null.exe`. I also tried
this:

PS C:\> cc -xc++ -o $null -lc++ -shared
cc.exe: fatal error: no input files

It appears the issue is specific to GCC. If I get Clang [1], the same command
works with `nul` [2]:

cc -xc++ -onul -lc++ -shared

but if I try the same thing with GCC, I get this:

C:/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../
x86_64-w64-mingw32/bin/ld.exe: nul.exe: final close failed: file truncated

Alternatively, if anyone knows a better way to check the availability of a
library, I would be interested in that.

[1] https://github.com/mstorsjo/llvm-mingw
[2] https://support.microsoft.com/help/110930

[Bug c++/97531] Improve type/non-type declaration diagnostic

2020-10-25 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97531

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2020-10-25
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Extended test:

// PR c++/97531

struct A { };
void A(int);

void
fn0 ()
{
  A a;
  static A *a2;
}

int B;
struct B { };

void
fn1 ()
{
  B b;
  static B *b2;
}

enum E { };
void E();

void
fn2 ()
{
  E e;
  static E *e2;
}

class C { };
void C(int);

void
fn3 ()
{
  C c;
  static C *c2;
}

union U { };
void U(int);

void
fn4 ()
{
  U u;
  static U *u2;
}

[Bug libstdc++/96817] __cxa_guard_acquire unsafe against dynamically loaded pthread

2020-10-25 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96817

--- Comment #19 from Jonathan Wakely  ---
I don't really care about test failures for non-standard configurations like
that.

[Bug c++/97563] undefined reference to `std::__cxx11::basic_string, std::allocator >::reserve()'

2020-10-25 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97563

Jonathan Wakely  changed:

   What|Removed |Added

 Resolution|FIXED   |INVALID

[Bug c++/97572] [c++ 20] Constraining is broken

2020-10-25 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97572

--- Comment #1 from Jonathan Wakely  ---
I think GCC is correct to reject this. any(t) is not a valid constraint.

[Bug c++/97569] Declaring a struct in a field declaration of another struct. gcc and clang difference.

2020-10-25 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97569

--- Comment #1 from Jonathan Wakely  ---
(In reply to Anders Granlund from comment #0)
> The interesting thing is that if we replace  struct S  with  struct S {} 
> both compilers agree on rejecting the program.

I don't see any struct S in the example program.

[Bug c++/97573] Implement C++20 [depr.arith.conv.enum]

2020-10-25 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97573

--- Comment #1 from Marek Polacek  ---
Likewise, [depr.array.comp] should be implemented too.

[Bug c++/97573] Implement C++20 [depr.arith.conv.enum]

2020-10-25 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97573

Marek Polacek  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2020-10-25
   Keywords||diagnostic
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

[Bug c++/97573] New: Implement C++20 [depr.arith.conv.enum]

2020-10-25 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97573

Bug ID: 97573
   Summary: Implement C++20 [depr.arith.conv.enum]
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

P1120R0 added various deprecations, see [depr.arith.conv.enum]:

enum E1 { e };
enum E2 { f };
bool b = e <= 3.7;  // deprecated
int k = f - e;  // deprecated

but we don't warn for this, not even with -Wdeprecated -Wenum-compare
-Wfloat-conversion -Wfloat-equal -Wpedantic -Wall -Wextra etc.

In C++20, this should warn by default.

-Wenum-conversion is currently only valid for C, but that should change, so
that we can warn on the code above in C++17 too.

[Bug c++/95132] Concept checked after auto return type deduction

2020-10-25 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95132

Patrick Palka  changed:

   What|Removed |Added

 Status|WAITING |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
   Target Milestone|--- |10.3

--- Comment #3 from Patrick Palka  ---
(In reply to Patrick Palka from comment #2)
> (In reply to Francesco Biscani from comment #0)
> > This is problematic because it means that another concept that would check
> > whether or not bar() can be called with a specific argument type would fail
> > with a hard compile time error, instead of marking the concept as not
> > satisfied.
> 
> Would you have a concrete testcase for this behavior?

Ah, here's one:

$ cat testcase.C
template struct A {
  static auto f() requires false { return T::fail; }
};

template
constexpr int v = requires { A::f(); };

static_assert(!v);

$ g++ -std=c++20 testcase.C
testcase.C: In instantiation of ‘static auto A::f() requires  false [with T
= int]’:
testcase.C:   required from ‘constexpr const int v’
testcase.C:   required from here
testcase.C: error: ‘fail’ is not a member of ‘int’
2 |   static auto f() requires false { return T::fail; }
  |  ^~~~


We wrongly issue a hard error for the reason you pointed out.

[Bug c++/97572] New: [c++ 20] Constraining is broken

2020-10-25 Thread dimitri.gorokhovik at free dot fr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97572

Bug ID: 97572
   Summary: [c++ 20] Constraining is broken
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dimitri.gorokhovik at free dot fr
  Target Milestone: ---

The code:

constexpr bool any (bool) { return true; };
template  concept Any = requires (T t) { requires any (t); };
constexpr static int f (Any auto) { return 42; };
constexpr auto q = f (false);


when compiled as:

g++ -std=c++20  -o bug-9.o -c  bug-9.cpp


produces:

bug-9.cpp: In substitution of ‘template  requires  Any
constexpr int f(auto:1) [with auto:1 = bool]’:
bug-9.cpp:5:28:   required from here
bug-9.cpp:3:63: error: ‘t’ is not a constant expression
3 | template  concept Any = requires (T t) { requires any (t);
};
  |  ~^~~
bug-9.cpp:5:28: error: no matching function for call to ‘f(bool)’
5 | constexpr auto q = f (false);
  |^
bug-9.cpp:4:22: note: candidate: ‘template  requires  Any
constexpr int f(auto:1)’
4 | constexpr static int f (Any auto) { return 42; };
  |  ^
bug-9.cpp:4:22: note:   substitution of deduced template arguments resulted in
errors seen above


GCC version:

g++ (GCC) 11.0.0 20201025 (experimental)

[Bug fortran/97571] New: long parsing phase for simple array constructor

2020-10-25 Thread rimvydas.jas at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97571

Bug ID: 97571
   Summary: long parsing phase for simple array constructor
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rimvydas.jas at gmail dot com
  Target Milestone: ---

gcc version 11.0.0 20201025 (experimental) [master revision
d7ddd287c:9f8172cd7:47d13acbda9a5d8eb57ff169ba74857cd54108e4] (GCC)

x86_64-unknown-linux 

$ cat init.f90
subroutine bpr_init
implicit none
integer :: i
real :: tacos2( 0:35250)
tacos2 = acos( (/ (i, i=64000,99250) /) / 10.0)
end subroutine bpr_init

$ gfortran -O1 -Wall -Wextra -c init.f90 -ftime-report
init.f90:4:24:

4 | real :: tacos2( 0:35250)
  |1
Warning: Array 'tacos2' at (1) is larger than limit set by
'-fmax-stack-var-size=', moved from stack to static storage. This makes the
procedure unsafe when called recursively, or concurrently from multiple
threads. Consider using '-frecursive', or increase the '-fmax-stack-var-size='
limit, or change the code to use an ALLOCATABLE array. [-Wsurprising]

Time variable   usr   sys  wall
  GGC
 phase parsing  :1923.03 (100%)   0.21 (100%)1923.67 (100%)
 7500k ( 97%)
 phase opt and generate :   0.01 (  0%)   0.00 (  0%)   0.02 (  0%)
   69k (  1%)
 callgraph functions expansion  :   0.01 (  0%)   0.00 (  0%)   0.01 (  0%)
   48k (  1%)
 parser (global):1923.02 (100%)   0.21 (100%)1923.67 (100%)
 7500k ( 97%)
 tree gimplify  :   0.00 (  0%)   0.00 (  0%)   0.01 (  0%)
 1752  (  0%)
 tree STMT verifier :   0.00 (  0%)   0.00 (  0%)   0.01 (  0%)
0  (  0%)
 varconst   :   0.01 (  0%)   0.00 (  0%)   0.00 (  0%)
0  (  0%)
 initialize rtl :   0.01 (  0%)   0.00 (  0%)   0.00 (  0%)
   12k (  0%)
 TOTAL  :1923.04  0.21   1923.69   
 7756k
Extra diagnostic checks enabled; compiler may run slowly.
Configure with --enable-checking=release to disable checks.

Configuring with checking=release or different -O levels have no impact on time
taken, previous gfortran 10.2 did not exhibit such long parsing times.

[Bug c++/97563] undefined reference to `std::__cxx11::basic_string, std::allocator >::reserve()'

2020-10-25 Thread dti--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97563

Damian  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Damian  ---
hello, 

with a fresh rebuild of gcc 11 it works. 

Best regards
Damian

[Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity

2020-10-25 Thread matwey.kornilov at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97570

Bug ID: 97570
   Summary: avr-gcc: error: 'void* memalign' redeclared as
different kind of entity
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: matwey.kornilov at gmail dot com
  Target Milestone: ---

Hi,

While I am trying to build avr-gcc from master with Freestanding C++ standard
library on x86_64 host system, I see the following compile error:


../../../../libstdc++-v3/libsupc++/new_opa.cc:56:18: error: 'void* memalign'
redeclared as different kind of entity
   56 |   void *memalign(size_t alignment, size_t size);
  |  ^~
../../../../libstdc++-v3/libsupc++/new_opa.cc:39:18: note: previous declaration
'void* memalign(std::size_t, std::size_t)'
   39 | extern "C" void *memalign(std::size_t boundary, std::size_t size);
  |  ^~~~
../../../../libstdc++-v3/libsupc++/new_opa.cc:56:18: error: 'size_t' was not
declared in this scope; did you mean 'std::size_t'?
   56 |   void *memalign(size_t alignment, size_t size);
  |  ^~
  |  std::size_t
In file included from ../../../../libstdc++-v3/libsupc++/new_opa.cc:26:
/usr/src/gcc/avr-obj/avr/libstdc++-v3/include/avr/bits/c++config.h:280:33:
note: 'std::size_t' declared here
  280 |   typedef __SIZE_TYPE__ size_t;
  | ^~
../../../../libstdc++-v3/libsupc++/new_opa.cc:56:36: error: 'size_t' was not
declared in this scope; did you mean 'std::size_t'?
   56 |   void *memalign(size_t alignment, size_t size);
  |^~
  |std::size_t
In file included from ../../../../libstdc++-v3/libsupc++/new_opa.cc:26:
/usr/src/gcc/avr-obj/avr/libstdc++-v3/include/avr/bits/c++config.h:280:33:
note: 'std::size_t' declared here
  280 |   typedef __SIZE_TYPE__ size_t;
  | ^~


I use binutils 2.35 and gcc 47d13acbda9a5d8eb57ff169ba74857cd54108e4


Steps to reproduce:

1. Build and install gcc without libstdc++:

# ../configure --prefix=/usr --target=avr --enable-languages=c,c++
--disable-nls --disable-libssp --with-dwarf2
# make
# make install

2. Build and install avr-libc 2.0

# ../configure --prefix=/usr --build=`../config.guess` --host=avr
# make
# make install

3. Rebuild gcc with Freestanding libstdc++

# ../configure --prefix=/usr --target=avr --enable-languages=c,c++
--disable-nls --disable-libssp --with-dwarf2 --with-newlib
--disable-__cxa_atexit --disable-threads --disable-shared --enable-static
--disable-sjlj-exceptions --enable-libstdcxx --enable-lto
--disable-hosted-libstdcxx
# make

See the error.


The following simple patch fixes the issue:

--- a/libstdc++-v3/libsupc++/new_opa.cc
+++ b/libstdc++-v3/libsupc++/new_opa.cc
@@ -53,7 +53,7 @@ extern "C"
 # elif _GLIBCXX_HAVE_POSIX_MEMALIGN
   void *posix_memalign(void **, size_t alignment, size_t size);
 # elif _GLIBCXX_HAVE_MEMALIGN
-  void *memalign(size_t alignment, size_t size);
+  void *memalign(std::size_t alignment, std::size_t size);
 # endif
 }
 #endif

Then gcc and libstdc++ are compiled and installed successfully without any
further errors. But I doubt that this is correct way to handle this issue.

[Bug c++/97569] New: Declaring a struct in a field declaration of another struct.

2020-10-25 Thread anders.granlund.0 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97569

Bug ID: 97569
   Summary: Declaring a struct in a field declaration of another
struct.
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: anders.granlund.0 at gmail dot com
  Target Milestone: ---

Consider the following c++ program:

  int main()
  {
  struct A
  {
struct B *b;
  };

  using U = B;   
  }

Compile it with "-std=c++20 -pedantic-errors".

The gcc compiler accepts it.

Clang however rejects it with the following error 
message: "unknown type name 'B': using U = B;".

The interesting thing is that if we replace  struct S  with  struct S {}  both
compilers agree on rejecting the program.

I'm not sure if this is a bug in gcc or clang, but I think this is a gcc bug.

[Bug analyzer/97568] New: -fanalyzer assumes that an extern const pointer is NULL

2020-10-25 Thread vincent-gcc at vinc17 dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97568

Bug ID: 97568
   Summary: -fanalyzer assumes that an extern const pointer is
NULL
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: vincent-gcc at vinc17 dot net
  Target Milestone: ---

On the following program tst.c:

extern int *const s;
int main (void)
{
  return s[0];
}

I get under Debian/unstable:


zira:~> gcc-snapshot -fanalyzer -c tst.c
tst.c: In function 'main':
tst.c:4:11: warning: dereference of NULL '0' [CWE-690]
[-Wanalyzer-null-dereference]
4 |   return s[0];
  |  ~^~~
  'main': event 1
|
|

This occurs with:

gcc (Debian 20201023-1) 11.0.0 20201023 (experimental) [master revision
d08d481912b:b3da6ca6235:9e3b9ddb996f18d541a3e03611d46c3a6c0c0b5f]

There was no such issue with:

gcc (Debian 20201002-1) 11.0.0 20201002 (experimental) [master revision
05d39f0de9e:767e018251e:1d3e12c469e5f5627c2e271232e1a3d8a88783be]

[Bug tree-optimization/97567] [11 Regression] wrong code at -Os and above on x86_64-pc-linux-gnu

2020-10-25 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97567

Jakub Jelinek  changed:

   What|Removed |Added

   Last reconfirmed||2020-10-25
   Target Milestone|--- |11.0
   Priority|P3  |P1
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
 CC||aldyh at gcc dot gnu.org,
   ||amacleod at redhat dot com,
   ||jakub at gcc dot gnu.org
Summary|wrong code at -Os and above |[11 Regression] wrong code
   |on x86_64-pc-linux-gnu  |at -Os and above on
   ||x86_64-pc-linux-gnu

--- Comment #1 from Jakub Jelinek  ---
Started with r11-3685-gfcae5121154d1c3382b056bcc2c563cedac28e74

[Bug fortran/97530] Segmentation fault compiling coarray program with option -fcoarray=shared (not with -fcoarray={lib,single})

2020-10-25 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97530

Thomas Koenig  changed:

   What|Removed |Added

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

--- Comment #4 from Thomas Koenig  ---
Fixed by 

https://gcc.gnu.org/g:9dca1f29608df4bda70b33be735373ac18b8714b

Thanks a lot for the bug report!

I think we need a way to run the whole testsuite with -fcoarray=shared
to spot any other issues like this.

[Bug fortran/88076] Shared Memory implementation for Coarrays

2020-10-25 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88076
Bug 88076 depends on bug 97530, which changed state.

Bug 97530 Summary: Segmentation fault compiling coarray program with option 
-fcoarray=shared (not with -fcoarray={lib,single})
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97530

   What|Removed |Added

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

[Bug libstdc++/96817] __cxa_guard_acquire unsafe against dynamically loaded pthread

2020-10-25 Thread rimvydas.jas at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96817

Rimvydas (RJ)  changed:

   What|Removed |Added

 CC||rimvydas.jas at gmail dot com

--- Comment #18 from Rimvydas (RJ)  ---
When libstdc++ is configured with --disable-linux-futex for use in valgrind,
the g:e6923541fae5081b646f240d54de2a32e17a0382 on x86_64-linux gives

WARNING: 18_support/96817.cc execution test program timed out.
FAIL: 18_support/96817.cc execution test

Also, disabling linux-futex fails libstdc++-abi/abi_check for symbols?
std::__atomic_futex_unsigned_base::_M_futex_wait_until()
std::__atomic_futex_unsigned_base::_M_futex_notify_all()

[Bug libgomp/88707] Random failures of libgomp.c++/task-reduction-(8|10|11|13).C

2020-10-25 Thread rimvydas.jas at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88707

Rimvydas (RJ)  changed:

   What|Removed |Added

 CC||rimvydas.jas at gmail dot com

--- Comment #5 from Rimvydas (RJ)  ---
Reproducible on x86_64-linux when configured with --disable-linux-futex

WARNING: program timed out.
FAIL: libgomp.c++/task-reduction-10.C execution test
WARNING: program timed out.
FAIL: libgomp.c++/task-reduction-11.C execution test
WARNING: program timed out.
FAIL: libgomp.c++/task-reduction-13.C execution test
WARNING: program timed out.
FAIL: libgomp.c++/task-reduction-8.C execution test

Disabling use of futexes is needed to avoid lots of false positives in valgrind
for obvious reasons.

[Bug tree-optimization/97567] New: wrong code at -Os and above on x86_64-pc-linux-gnu

2020-10-25 Thread su at cs dot ucdavis.edu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97567

Bug ID: 97567
   Summary: wrong code at -Os and above on x86_64-pc-linux-gnu
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

[550] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201025 (experimental) [master revision
1aeb7d7d67d:7a48d67add1:d7ddd287ca76e87f431f43687de6d8cc48e52543] (GCC)
[551] %
[551] % gcctk -O1 small.c; ./a.out
[552] %
[552] % gcctk -Os small.c
[553] % ./a.out
Illegal instruction
[554] %
[554] % cat small.c
int a, b, c, d;
void k() {
  unsigned f = 1;
  long g = 4073709551615;
  for (; a; a++)
for (;;) {
  d = 0;
L1:
  break;
}
  if (f)
for (; a; a++)
  ;
  g || f;
  int i = 0 - f || g;
  long j = g - f;
  if (j || f) {
if (g < 4073709551615)
  for (;;)
;
int e = ~f, h = b / ~e;
if (c)
  goto L2;
g = f = h;
  }
  g || d;
L2:
  if (c)
goto L1;
}
int main() { k(); return 0; }