[Bug c/100854] TS 18661-3 and backwards-incompatible setting of __FLT_EVAL_METHOD__

2021-12-23 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100854

--- Comment #3 from Hongtao.liu  ---
I'm testing

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index a25d59fa77b..4dab4d60773 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -8842,6 +8842,10 @@ excess_precision_mode_join (enum flt_eval_method x,
   || y == FLT_EVAL_METHOD_UNPREDICTABLE)
 return FLT_EVAL_METHOD_UNPREDICTABLE;

+  /* FLT_EVAL_METHOD only accepts negative values, 0, 1 or 2, but
+ FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16 is 16.  */
+if (x == y && x == FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16)
+  return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT;
   /* GCC only supports one interchange type right now, _Float16.  If
  we're evaluating _Float16 in 16-bit precision, then flt_eval_method
  will be FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16.  */

[Bug tree-optimization/38943] Optimization removes trapping instruction

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38943

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2021-07-20 00:00:00 |2021-12-23

--- Comment #2 from Andrew Pinski  ---
I think the test is invalid as you can still remove trapping math if the result
is not used; even with FENV access implemented.

[Bug testsuite/82390] gcc.dg/torture tests run with same optimization level

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82390

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2021-12-24

--- Comment #6 from Andrew Pinski  ---
Confirmed, this is the current list:
apinski@xeond:~/src/upstream-gcc/gcc/gcc/testsuite$ git grep dg-options
gcc.dg/torture gcc.c-torture/ g++.dg/torture/ c-c++-common/torture/ |grep -- -O
g++.dg/torture/pr33134.C:/* { dg-options "-O2" } */
g++.dg/torture/pr36745.C:/* { dg-options "-O2 -fPIC -Wno-return-type" } */
g++.dg/torture/pr39259.C:// { dg-options "-O2" }
g++.dg/torture/pr48954.C:/* { dg-options "-O2 -flto -fno-early-inlining
-fkeep-inline-functions" } */
g++.dg/torture/pr51903.C:// { dg-options "-O2 -fnon-call-exceptions
-fno-guess-branch-probability" }
g++.dg/torture/pr58201_1.C:/* { dg-options "-O2" } */
g++.dg/torture/pr64988.C:// { dg-options "-O -fdeclone-ctor-dtor" }
g++.dg/torture/pr81462.C:// { dg-options "-O1 -fno-ipa-pure-const" }
g++.dg/torture/pr83718.C:/* { dg-options "-O2 -std=c++11" } */
gcc.c-torture/compile/asmgoto-4.c:/* { dg-options "-O0 -fdump-rtl-reload" } */
gcc.c-torture/compile/pr48641.c:/* { dg-options "-O -fno-tree-ccp
-fno-tree-copy-prop" } */
gcc.c-torture/compile/pr69102.c:/* { dg-options "-Og -fPIC -fschedule-insns2
-fselective-scheduling2 -fno-tree-fre
--param=max-sched-extend-regions-iters=10" } */
gcc.c-torture/compile/pr72749.c:/* { dg-options "-O2 -fsched2-use-superblocks"
} */
gcc.c-torture/compile/pr83575.c:/* { dg-options "-O2 -funroll-loops
-fno-tree-dominator-opts -fno-tree-loop-im -fno-code-hoisting -fno-tree-pre
-fno-guess-branch-probability" } */
gcc.c-torture/compile/pr85401.c:/* { dg-options "-O2" } */
gcc.c-torture/execute/pr68381.c:/* { dg-options "-O -fexpensive-optimizations
-fno-tree-bit-ccp" } */
gcc.c-torture/execute/pr68390.c:/* { dg-options "-O2" } */
gcc.c-torture/execute/pr68532.c:/* { dg-options "-O2 -ftree-vectorize
-fno-vect-cost-model" } */
gcc.dg/torture/builtin-sprintf.c:   { dg-options "-O2 -Wall" }
gcc.dg/torture/cris-asm-mof-1.c:/* { dg-options "-O2 -march=v10" } */
gcc.dg/torture/pr36244.c:/* { dg-options "-O3 -ftree-parallelize-loops=4" } */
gcc.dg/torture/pr68906.c:/* { dg-options "-O3" } */
gcc.dg/torture/pr70935.c:/* { dg-options "-O3 -g" } */
gcc.dg/torture/pr77916.c:/* { dg-options "-O3 -Wno-int-conversion" } */
gcc.dg/torture/pr77937-1.c:/* { dg-options "-O3" } */
gcc.dg/torture/pr77937-2.c:/* { dg-options "-O3" } */
gcc.dg/torture/pr98289.c:/* { dg-options "-O2 -freorder-blocks-and-partition" }
*/


I do think the patch is wrong as mentioned, rather what it should test if one
of the options was a -O* option instead.

[Bug target/60480] gcc 4.8.2 fails to do optimization on global register variables when compiling on x86_64 Linux.

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60480

Andrew Pinski  changed:

   What|Removed |Added

  Known to work||7.1.0
   Target Milestone|--- |9.0
 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #3 from Andrew Pinski  ---
GCC 9 is:
movq%r14, -8(%r15)
movq%r14, %rax
leaq-8(%r15), %r14
movq%r14, %r15
movq%rax, %r14
addq$8, %r15

So fixed for GCC 9.

[Bug target/50135] Loop optimization.

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50135

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |WONTFIX
 Status|SUSPENDED   |RESOLVED

--- Comment #4 from Andrew Pinski  ---
As mentioned the loop instruction is not very useful at on any modern processor
so closing as won't fix.

[Bug lto/53777] [lto] lto does not propagate optimization flags from command lines given at "compilation time"

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53777

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |12.0
 Resolution|--- |FIXED
   Keywords||lto
 Status|WAITING |RESOLVED

--- Comment #5 from Andrew Pinski  ---
I think the problem listed here is all fully fixed on the trunk (there has been
many improvements over time even to get this fixed, even as recently as
r12-5920 [PR 103515] ).

gcc-bugs@gcc.gnu.org

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39094

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=66718

--- Comment #1 from Andrew Pinski  ---
Hmm, do we need this any more after gimple-laddress (PR66718) was added?

[Bug c/100854] TS 18661-3 and backwards-incompatible setting of __FLT_EVAL_METHOD__

2021-12-23 Thread fxcoudert at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100854

Francois-Xavier Coudert  changed:

   What|Removed |Added

 CC||fxcoudert at gcc dot gnu.org

--- Comment #2 from Francois-Xavier Coudert  ---
This affects x86_64-apple-darwin:
https://gcc.gnu.org/pipermail/gcc/2021-December/237959.html

The  system header errors out on any value of __FLT_EVAL_METHOD__ that
is not -1, 0, 1, or 2.

[Bug fortran/102595] ICE in var_element, at fortran/decl.c:298 since r10-5607-gde89b5748d68b76b

2021-12-23 Thread kargl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102595

kargl at gcc dot gnu.org changed:

   What|Removed |Added

  Attachment #52053|0   |1
is obsolete||

--- Comment #5 from kargl at gcc dot gnu.org ---
Created attachment 52054
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52054&action=edit
new patch

This is a better patch and now deals with the legal code

program foo
   complex a
   data a%re, a%im /1., 2./
   print *, a%re, a%im
end program foo

and the invalid code

program foo
   complex a
   data a%re, a%re /1., 2./
   print *, a%re, a%im
end program foo

[Bug middle-end/80929] [9/10/11/12 Regression] Division with constant no more optimized to mult highpart

2021-12-23 Thread roger at nextmovesoftware dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80929

Roger Sayle  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||roger at nextmovesoftware dot 
com
 Resolution|--- |FIXED
   Target Milestone|9.5 |11.3

--- Comment #17 from Roger Sayle  ---
According to godbolt, with the example from comment #6, this appears to have
been fixed in gcc 11.1, but was still present (generated calls to __divmodhi4)
back in gcc 10.3.  Likewise the original example in comment #1 has been fixed
since gcc 5.4, but was broken in gcc 4.6.4.

[Bug target/103785] [12 Regression] Ada bootstrap ICEs on i?86

2021-12-23 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103785

H.J. Lu  changed:

   What|Removed |Added

 CC||ubizjak at gmail dot com

--- Comment #6 from H.J. Lu  ---
A patch is posted at

https://gcc.gnu.org/pipermail/gcc-patches/2021-December/587326.html

[Bug hsa/86948] Internal compiler error compiling brig.dg/test/gimple/mulhi.hsail

2021-12-23 Thread roger at nextmovesoftware dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86948

Roger Sayle  changed:

   What|Removed |Added

 CC||roger at nextmovesoftware dot 
com
 Ever confirmed|0   |1
   Last reconfirmed||2021-12-23
 Status|UNCONFIRMED |NEW

--- Comment #7 from Roger Sayle  ---
A default expansion for MULT_HIGHPART_EXPR was proposed as part of
https://gcc.gnu.org/pipermail/gcc-patches/2020-August/551316.html
I'll split off just that part of the patch and resubmit it for review.

[Bug tree-optimization/99620] Subtract with borrow (SBB) missed optimization

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99620

--- Comment #5 from Andrew Pinski  ---
  l_7 = a$l_12 - _1;
  k_8 = l_7 > a$l_12;

vs:

  l_6 = a$l_11 - b$l_12;
  k_7 = a$l_11 < b$l_12;

[Bug target/99548] Help me! Lost the fight against the compiler.

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99548

--- Comment #3 from Andrew Pinski  ---
#include
#include
#if defined(_MSC_VER)
#include
#elif defined(__x86_64__) || defined(__i386__)
#include
#endif
using field_number =
std::conditional_t=8,std::array,std::array>;
namespace intrinsics
{
template
#if __cpp_lib_concepts >= 202002L
requires (std::unsigned_integral)
#endif
inline constexpr bool sub_borrow(bool borrow,T a,T b,T& out) noexcept
{
#if defined(_MSC_VER) || defined(__x86_64__) || defined(__i386__)
#if __cpp_lib_is_constant_evaluated >= 201811L
if(std::is_constant_evaluated())
return (out=a-b-borrow)>=a;
else
#endif
{
if constexpr(sizeof(T)==8)
#if defined(__x86_64__)
return _subborrow_u64(borrow,a,b,
#if !defined(__INTEL_COMPILER ) &&(defined(__GNUC__) || defined(__clang__))
reinterpret_cast(&out));
#else
&out);
#endif
#else
return (out=a-b-borrow)>=a;
#endif

if constexpr(sizeof(T)==4)
return
_subborrow_u32(borrow,a,b,reinterpret_cast(&out));
else if constexpr(sizeof(T)==2)
return
_subborrow_u16(borrow,a,b,reinterpret_cast(&out));
else if constexpr(sizeof(T)==1)
return
_subborrow_u8(borrow,a,b,reinterpret_cast(&out));
}
#else
return (out=a-b-borrow)>=a;
#endif
}

}

template
#if __cpp_lib_concepts >= 202002L
requires (std::unsigned_integral)
#endif
inline constexpr bool add_carry(bool carry,T a,T b,T& out) noexcept
{
#if defined(_MSC_VER) || defined(__x86_64__) || defined(__i386__)
#if __cpp_lib_is_constant_evaluated >= 201811L
if(std::is_constant_evaluated())
return (out=a+b+carry)<=a;
else
#endif
{
if constexpr(sizeof(T)==8)
#if defined(__x86_64__)
return _addcarry_u64(carry,a,b,
#if !defined(__INTEL_COMPILER ) &&(defined(__GNUC__) || defined(__clang__))
reinterpret_cast(&out));
#else
&out);
#endif
#else
return (out=a+b+carry)<=a;
#endif

else if constexpr(sizeof(T)==4)
return
_addcarry_u32(carry,a,b,reinterpret_cast(&out));
else if constexpr(sizeof(T)==2)
return
_addcarry_u16(carry,a,b,reinterpret_cast(&out));
else if constexpr(sizeof(T)==1)
return
_addcarry_u8(carry,a,b,reinterpret_cast(&out));
}
#else
return (out=a+b+carry)<=a;
#endif
}

void my_asm_field_add(
std::uint64_t* __restrict r,
std::uint64_t const* __restrict x,
std::uint64_t const* __restrict y) noexcept
{
std::uint64_t r0,r1,r2,r3;
std::uint64_t rv;
__asm__ __volatile__(R"(mov (%[x]),%[r0]
add (%[y]),%[r0]
mov 8(%[x]),%[r1]
adc 8(%[y]),%[r1]
mov 16(%[x]),%[r2]
adc 16(%[y]),%[r2]
mov 24(%[x]),%[r3]
adc 24(%[y]),%[r3]
sbb %[rv],%[rv]
and $38,%[rv]
add %[rv],%[r0]
adc $0,%[r1]
adc $0,%[r2]
adc $0,%[r3]
sbb %[rv],%[rv]
and $38,%[rv]
add %[rv],%[r0]
mov %[r0],(%[res])
adc $0,%[r1]
mov %[r1],8(%[res])
adc $0,%[r2]
mov %[r2],16(%[res])
adc $0,%[r3]
mov %[r3],24(%[res]))":
[r0]"=&r"(r0),[r1]"=&r"(r1),[r2]"=&r"(r2),[r3]"=&r"(r3),[rv]"=&r"(rv):
[x]"r"(x),[y]"r"(y),[res]"r"(r):"memory","cc");
}

void intrinsics_add(std::uint64_t* __restrict f,
std::uint64_t const* __restrict x,
std::uint64_t const* __restrict y) noexcept
{
using namespace intrinsics;
using unsigned_type = field_number::value_type;
constexpr unsigned_type zero{};
std::uint64_t f0,f1,f2,f3;
bool carry{add_carry(false,x[0],y[0],f0)};
carry=add_carry(carry,x[1],y[1],f1);
carry=add_carry(carry,x[2],y[2],f2);
carry=add_carry(carry,x[3],y[3],f3);
unsigned_type v=0;
sub_borrow(carry,v,v,v);
v&=static_cast(38);
carry=add_carry(false,f0,v,f0);
carry=add_carry(carry,f1,zero,f1);
carry=add_carry(carry,f2,zero,f2);
carry=add_carry(carry,f3,zero,f3);
sub_borrow(carry,v,v,v);
v&=static_cast(38);
carry=add_carry(false,f0,v,f[0]);
carry=add_carry(carry,f1,zero,f[1]);
carry=add_carry(carry,f2,zero,f[2]);
carry=add_carry(carry,f3,zero,f[3]);
}

[Bug c++/99539] Varargs are allowed in requires expression

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99539

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2021-12-23
 Status|UNCONFIRMED |NEW

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

[Bug rtl-optimization/99551] aarch64: csel is used for cold scalar computation which affects performance

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99551

--- Comment #2 from Andrew Pinski  ---
if-conversion succeeded through noce_try_cmove_arith
Removing jump 8.
deleting insn with uid = 8.
deleting insn with uid = 11.
deleting insn with uid = 10.
deleting block 3
Merging block 4 into block 2...
changing bb of uid 13
changing bb of uid 18
  from 4 to 2
changing bb of uid 19
  from 4 to 2
Merged blocks 2 and 4.
Conversion succeeded on pass 1.

[Bug target/99228] blend/shuffle

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99228

--- Comment #6 from Andrew Pinski  ---
Hmm, the trunk no longer does the if conversion:

complex_sgn(std::complex const&):
.LFB2678:
.cfi_startproc
vmovsd  xmm0, QWORD PTR [rdi]
vxorpd  xmm1, xmm1, xmm1
vcomisd xmm0, xmm1
jne .L8
vmovsd  xmm0, QWORD PTR [rdi+8]
vcomisd xmm0, xmm1
je  .L13
.L8:
vandpd  xmm0, xmm0, XMMWORD PTR .LC1[rip]
vorpd   xmm0, xmm0, XMMWORD PTR .LC2[rip]
ret

[Bug bootstrap/103820] [12 Regression] i686 failed to bootstrap with ada by r12-6077

2021-12-23 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103820

--- Comment #5 from H.J. Lu  ---
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 284b9507466..9d6786c5c2e 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -8588,7 +8588,8 @@ (define_peephole2
 (any_mul_highpart:SWI48 (match_dup 2) (match_dup 0)))
 (clobber (match_dup 2))
 (clobber (reg:CC FLAGS_REG))])]
-  "REGNO (operands[0]) != REGNO (operands[2])
+  "TARGET_64BIT
+   && REGNO (operands[0]) != REGNO (operands[2])
&& REGNO (operands[0]) != REGNO (operands[3])
&& (REGNO (operands[0]) == REGNO (operands[4])
|| peep2_reg_dead_p (3, operands[0]))"

is sufficient to restore bootstrap.

[Bug rtl-optimization/98977] [x86] Failure to optimize consecutive sub flags usage

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98977

Andrew Pinski  changed:

   What|Removed |Added

  Component|target  |rtl-optimization
 Target|x86_64-*-* i?86-*-* |x86_64-*-* i?86-*-*
   ||aarch64*-*-*

--- Comment #2 from Andrew Pinski  ---
Here is a testcase which shows the issue on other targets (aarch64) too:
#include 
#include 

extern bool z, c;

uint32_t f(uint32_t dest, uint32_t src)
{
uint32_t res = dest - src;
z = !res;
c = src > dest;
return res;
}

[Bug target/98977] [x86] Failure to optimize consecutive sub flags usage

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98977

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2021-12-23
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
 Depends on||3507

--- Comment #1 from Andrew Pinski  ---
Confirmed, PR 3507 is part of it (maybe all of it) as shown by:
#include 
#include 

extern bool z, c;

uint8_t f(uint8_t dest, uint8_t src)
{
uint8_t res = dest - src;
//z = !res;
c = src > dest;
return res;
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3507
[Bug 3507] appalling optimisation with sub/cmp on multiple targets

[Bug bootstrap/103820] [12 Regression] i686 failed to bootstrap with ada by r12-6077

2021-12-23 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103820

--- Comment #4 from H.J. Lu  ---
(In reply to Roger Sayle from comment #3)
> Thanks for investigating this HJ (I'm having difficulty configuring my

You can bootstrap 32bit GCC on Linux/x86-64 if 32-bit libraries are
available.

> system to reproduce this).  Is the TARGET_64BIT guard needed by both
> peephole2s, or is one sufficient to restore bootstrap?  Your fix/workaround

I will double check.

> (disabling the optimization on -m32) looks good, but I still can't figure
> out what about this transformation is unsafe, and therefore perhaps latent
> on -m64.  Sorry again for the inconvenience.

[Bug bootstrap/103820] [12 Regression] i686 failed to bootstrap with ada by r12-6077

2021-12-23 Thread roger at nextmovesoftware dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103820

--- Comment #3 from Roger Sayle  ---
Thanks for investigating this HJ (I'm having difficulty configuring my system
to reproduce this).  Is the TARGET_64BIT guard needed by both peephole2s, or is
one sufficient to restore bootstrap?  Your fix/workaround (disabling the
optimization on -m32) looks good, but I still can't figure out what about this
transformation is unsafe, and therefore perhaps latent on -m64.  Sorry again
for the inconvenience.

[Bug fortran/102595] ICE in var_element, at fortran/decl.c:298 since r10-5607-gde89b5748d68b76b

2021-12-23 Thread kargl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102595

--- Comment #4 from kargl at gcc dot gnu.org ---
Comment on attachment 52053
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52053
patch

This patch fixes the problem in the PR and addresses a few
niggles I found as I poked gfortran.  Some of those errors
don't occur without this patch.

program p
   complex, parameter :: x(0) = 2
!   complex :: x(0) = 2! { dg-error "more values than variables" }
!   complex :: x(1) = 2! { dg-error "already is initialized" }
!   complex :: x = 2   ! { dg-error "already is initialized" }
!   complex :: x(1)! Works (as expected?)
!   complex :: x(0)! { dg-error "more values than variables" }
   data x%re /3.0/
   print *, x%re
end

[Bug tree-optimization/103821] [12 Regression] huge compile time (jump threading) at -O3 for simple code

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103821

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=103815

--- Comment #1 from Andrew Pinski  ---
I found this while looking into PR 103815.

[Bug tree-optimization/103821] [12 Regression] huge compile time (jump threading) at -O3 for simple code

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103821

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |12.0

[Bug tree-optimization/103821] New: [12 Regression] huge compile time (jump threading) at -O3 for simple code

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103821

Bug ID: 103821
   Summary: [12 Regression] huge compile time (jump threading) at
-O3 for simple code
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: compile-time-hog
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
#include 
uint16_t int_sqrt32(uint32_t x)
{
uint16_t res=0;
uint16_t add= 0x8000;   
do {
uint16_t temp=res | add;
uint32_t g2=temp*temp;  
if (x>=g2)
res=temp;   
add>>=1;
} while(add);
return res;
}
- CUT -
Compile this at -O3 and GCC takes a long time:
 backwards jump threading   :  20.12 ( 81%)   0.01 ( 50%)  20.12 ( 78%)
   26M ( 79%)

[Bug fortran/102595] ICE in var_element, at fortran/decl.c:298 since r10-5607-gde89b5748d68b76b

2021-12-23 Thread kargl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102595

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org ---
Created attachment 52053
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52053&action=edit
patch

[Bug target/103785] [12 Regression] Ada bootstrap ICEs on i?86

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103785

Andrew Pinski  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

--- Comment #5 from Andrew Pinski  ---
*** Bug 103820 has been marked as a duplicate of this bug. ***

[Bug bootstrap/103820] [12 Regression] i686 failed to bootstrap with ada by r12-6077

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103820

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED

--- Comment #2 from Andrew Pinski  ---
Dup of bug 103785.

*** This bug has been marked as a duplicate of bug 103785 ***

[Bug bootstrap/103820] [12 Regression] i686 failed to bootstrap with ada by r12-6077

2021-12-23 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103820

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2021-12-23

--- Comment #1 from H.J. Lu  ---
This patch:

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 284b9507466..4eb217a93ee 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -8588,7 +8588,8 @@ (define_peephole2
   (any_mul_highpart:SWI48 (match_dup 2) (match_dup 0)))
  (clobber (match_dup 2))
  (clobber (reg:CC FLAGS_REG))])]
-  "REGNO (operands[0]) != REGNO (operands[2])
+  "TARGET_64BIT
+   && REGNO (operands[0]) != REGNO (operands[2])
&& REGNO (operands[0]) != REGNO (operands[3])
&& (REGNO (operands[0]) == REGNO (operands[4])
|| peep2_reg_dead_p (3, operands[0]))"
@@ -8608,7 +8609,8 @@ (define_peephole2
 (any_mul_highpart:SI (match_dup 2) (match_dup 0
  (clobber (match_dup 2))
  (clobber (reg:CC FLAGS_REG))])]
-  "REGNO (operands[0]) != REGNO (operands[2])
+  "TARGET_64BIT
+   && REGNO (operands[0]) != REGNO (operands[2])
&& REGNO (operands[0]) != REGNO (operands[3])
&& (REGNO (operands[0]) == REGNO (operands[4])
|| peep2_reg_dead_p (3, operands[0]))"

made bootstrap to pass the failed point.

[Bug bootstrap/103820] New: [12 Regression] i686 failed to bootstrap with ada by r12-6077

2021-12-23 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103820

Bug ID: 103820
   Summary: [12 Regression] i686 failed to bootstrap with ada by
r12-6077
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: bootstrap
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hjl.tools at gmail dot com
CC: roger at nextmovesoftware dot com, ubizjak at gmail dot com
  Target Milestone: ---
Target: i686

On Linux/i686, r12-6077 caused:

make[5]: ***
[/export/gnu/import/git/sources/gcc/gcc/ada/gcc-interface/Make-lang.in:167:
ada/exp_cg.o] Error 1
+===GNAT BUG DETECTED==+
| 12.0.0 20211223 (experimental) (i686-linux) Storage_Error stack overflow or
erroneous memory access|
| Error detected at system.ads:106:30  |
| Compiling /export/gnu/import/git/sources/gcc/gcc/ada/exp_ch11.adb|
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .  |
| Use a subject line meaningful to you and us to track the bug.|
| Include the entire contents of this bug box in the report.   |
| Include the exact command that you entered.  |
| Also include sources listed below.   |
+==+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

[Bug ipa/103818] [12 Regression] ICE: in insert, at ipa-modref-tree.c:591

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103818

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2021-12-23
   Keywords||ice-on-valid-code

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

[Bug ipa/103819] [10/11/12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||ice-checking
Summary|[12 Regression] ICE in  |[10/11/12 Regression] ICE
   |redirect_callee, at |in redirect_callee, at
   |cgraph.c:1389 with  |cgraph.c:1389 with
   |__attribute__((flatten))|__attribute__((flatten))
   |and -O2 |and -O2
  Known to fail||10.3.0, 11.1.0, 12.0
 Ever confirmed|0   |1
  Known to work||10.1.0, 10.2.0
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-12-23

--- Comment #1 from Andrew Pinski  ---
With -fchecking, GCC 10.3.0, 11.1.0 also ICE:
:22:1: error: calls_comdat_local is set outside of a comdat group
   22 | }
  | ^
:22:1: error: invalid calls_comdat_local flag
_Z16value_to_numericv/5 (void value_to_numeric()) @0x7f780edb3ca8
  Type: function definition analyzed
  Visibility: externally_visible public
  References: 
  Referring: 
  Availability: available
  Function flags: count:1073741824 (estimated locally) body calls_comdat_local
  Called by: 
  Calls: _ZN8OptionalI10CompletionED2Ev/25 (inlined) (1073741824 (estimated
locally),1.00 per call) 
:22: confused by earlier errors, bailing out

[Bug ipa/103819] [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
   Target Milestone|--- |12.0

[Bug c/103815] Misoptimization of a bounded do/while loop

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103815

--- Comment #1 from Andrew Pinski  ---
Note temp*temp is really ((int)temp)*((int)temp) due to interger promotion
rules in c/c++.

[Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2

2021-12-23 Thread dani at danielbertalan dot dev via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819

Bug ID: 103819
   Summary: [12 Regression] ICE in redirect_callee, at
cgraph.c:1389 with __attribute__((flatten)) and -O2
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dani at danielbertalan dot dev
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 52052
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52052&action=edit
Test case

Link to Compiler Explorer: https://godbolt.org/z/5bE9zsvfh

The following code fails to compile with gcc 12 (commit
61e53698a08dc1d9a54d785218af687a6751c1b3):

===
template  struct Optional {
  ~Optional() {
if (m_has_value)
  value();
  }
  T value();
  void release_value() { m_has_value = false; }
  bool m_has_value;
};
struct Completion {
  Optional m_target;
};
struct ThrowCompletionOr {
  void release_error() { m_throw_completion.release_value(); }
  Optional m_throw_completion;
} __trans_tmp_1;

__attribute__((flatten)) void value_to_numeric() {
  auto _temporary_result(__trans_tmp_1);
  _temporary_result.release_error();
}
===

The issue is both present in Compiler Explorer's trunk compiler, and in my
local build that has SerenityOS-specific patches applied. The error, as
reported by the latter, is:

$ g++ -O2 -v -save-temps -c repro.ii:
Using built-in specs.
COLLECT_GCC=../../Toolchain/Local/gcc-12/i686/bin/i686-pc-serenity-g++
Target: i686-pc-serenity
Configured with: ../../Tarballs/gcc/configure
--prefix=/home/dani/Projects/contributions/serenity/Toolchain/Local/gcc-12/i686
--target=i686-pc-serenity
--with-sysroot=/home/dani/Projects/contributions/serenity/Build/i686/Root
--disable-nls --with-newlib --enable-shared --enable-languages=c,c++
--enable-default-pie --enable-lto --enable-threads=posix
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211223 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-O2' '-v' '-save-temps' '-c' '-shared-libgcc'
'-mtune=generic' '-march=pentiumpro'

/home/dani/Projects/contributions/serenity/Toolchain/Local/gcc-12/i686/libexec/gcc/i686-pc-serenity/12.0.0/cc1plus
-fpreprocessed repro.ii -ftls-model=initial-exec -fPIC
-fno-semantic-interposition -quiet -dumpbase repro.ii -dumpbase-ext .ii
-mtune=generic -march=pentiumpro -O2 -version -ftls-model=initial-exec -o
repro.s
GNU C++17 (GCC) version 12.0.0 20211223 (experimental) (i686-pc-serenity)
compiled by GNU C version 11.1.0, GMP version 6.2.1, MPFR version
4.1.0-p13, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++17 (GCC) version 12.0.0 20211223 (experimental) (i686-pc-serenity)
compiled by GNU C version 11.1.0, GMP version 6.2.1, MPFR version
4.1.0-p13, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 42faffcdcc480dea6a6ccc95e1bcf344
during IPA pass: inline
repro.ii:21:1: internal compiler error: in redirect_callee, at cgraph.c:1389
   21 | }
  | ^
0x761a99 cgraph_edge::redirect_callee(cgraph_node*)
../../../Tarballs/gcc/gcc/cgraph.c:1389
0xf0a8af redirect_to_unreachable
../../../Tarballs/gcc/gcc/ipa-fnsummary.c:260
0xf0a8af edge_set_predicate
../../../Tarballs/gcc/gcc/ipa-fnsummary.c:284
0xf0ad3d remap_edge_summaries
../../../Tarballs/gcc/gcc/ipa-fnsummary.c:4037
0xf0e246 ipa_merge_fn_summary_after_inlining(cgraph_edge*)
../../../Tarballs/gcc/gcc/ipa-fnsummary.c:4200
0xf23cd5 inline_call(cgraph_edge*, bool, vec*,
int*, bool, bool*)
../../../Tarballs/gcc/gcc/ipa-inline-transform.c:504
0x1eb2477 flatten_function
../../../Tarballs/gcc/gcc/ipa-inline.c:2413
0x1eb69eb ipa_inline
../../../Tarballs/gcc/gcc/ipa-inline.c:2736
0x1eb69eb execute
../../../Tarballs/gcc/gcc/ipa-inline.c:3148

[Bug c/103818] New: ICE: in insert, at ipa-modref-tree.c:591

2021-12-23 Thread k.even-mendoza at imperial dot ac.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103818

Bug ID: 103818
   Summary: ICE: in insert, at ipa-modref-tree.c:591
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: k.even-mendoza at imperial dot ac.uk
  Target Milestone: ---

The following code fails with -O1, -O2, -O3, and -Os in GCC-12, but works fine
with -O0: 

struct a {
  int b[0]
} c(struct a *d) {
  d->b[0] = d->b[-144115188075855873] + d->b[11] * d->b[2] +
d->b[0] % d->b[1025] + d->b[5];
  d->b[0] =
  d->b[144678138029277184] + d->b[0] & d->b[-3] * d->b[053] + d->b[7] ^
  d->b[-9] + d->b[14] + d->b[9] % d->b[49] + d->b[024] + d->b[82] &
  d->b[4096];
}
void main() {}


It works fine with GCC-11. 

===
The trace in GCC-12 Version is:
/home/user42/data/gcc-csmith-1223/gcc-install/bin/gcc -O2 fuzzer-file-14593.c
fuzzer-file-14593.c:3:1: warning: no semicolon at end of struct or union
3 | } c(struct a *d) {
  | ^
during GIMPLE pass: modref
fuzzer-file-14593.c: In function ‘c’:
fuzzer-file-14593.c:11:1: internal compiler error: in insert, at
ipa-modref-tree.c:591
   11 | void main() {}
  | ^~~~
0x73439f modref_access_node::insert(vec*&,
modref_access_node, unsigned long, bool)
.././../gcc-source/gcc/ipa-modref-tree.c:591
0xcc201a modref_ref_node::insert_access(modref_access_node, unsigned long,
bool)
.././../gcc-source/gcc/ipa-modref-tree.h:194
0xcc201a modref_tree::insert(unsigned int, unsigned int, unsigned int,
int, int, modref_access_node, bool)
.././../gcc-source/gcc/ipa-modref-tree.h:445
0xcb303c modref_tree::insert(tree_node*, int, int, modref_access_node
const&, bool)
.././../gcc-source/gcc/ipa-modref-tree.h:472
0xcb303c record_access
.././../gcc-source/gcc/ipa-modref.c:1076
0xcb3968 analyze_load
.././../gcc-source/gcc/ipa-modref.c:1707
0xc09dd1 walk_stmt_load_store_addr_ops(gimple*, void*, bool (*)(gimple*,
tree_node*, tree_node*, void*), bool (*)(gimple*, tree_node*, tree_node*,
void*), bool (*)(gimple*, tree_node*, tree_node*, void*))
.././../gcc-source/gcc/gimple-walk.c:800
0xcbc7a1 analyze_stmt
.././../gcc-source/gcc/ipa-modref.c:1788
0xcbc7a1 analyze
.././../gcc-source/gcc/ipa-modref.c:1900
0xcbc7a1 analyze_function
.././../gcc-source/gcc/ipa-modref.c:3219
0xcbec2a execute
.././../gcc-source/gcc/ipa-modref.c:4186
Please submit a full bug report,
===

I tested it with gcc (GCC) 12.0.0 20211023 (experimental), gcc (GCC) 12.0.0
20211216 (experimental), and gcc (GCC) 12.0.0 20211223 (experimental) (current
version: commit ef26c151c14a87177d46fd3d725e7f82e040e89f) checking the fix of
bugs 102687 and 103073 there.

[Bug bootstrap/103817] Bootstrap broken on x86_64-apple-darwin21

2021-12-23 Thread fxcoudert at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103817

Francois-Xavier Coudert  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|UNCONFIRMED |RESOLVED

--- Comment #1 from Francois-Xavier Coudert  ---
Waiting, I think I got the --with-gmp=/usr/local/opt wrong, it's in /usr/local
and got picked by default by some checks but not all, explaining the weird
behavior.

[Bug bootstrap/103817] New: Bootstrap broken on x86_64-apple-darwin21

2021-12-23 Thread fxcoudert at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103817

Bug ID: 103817
   Summary: Bootstrap broken on x86_64-apple-darwin21
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: bootstrap
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fxcoudert at gcc dot gnu.org
  Target Milestone: ---

Bootstrap of gcc master at ef26c151c14a87177d46fd3d725e7f82e040e89f on
x86_64-apple-darwin21.2.0 is broken with:

In file included from ./bconfig.h:3,
 from ../../gcc/gcc/genmodes.c:20:
./auto-host.h:2667:16: error: declaration does not declare anything
[-fpermissive]
 2667 | #define rlim_t long
  |^~~~
In file included from ../../gcc/gcc/genmodes.c:21:
../../gcc/gcc/system.h:555:20: error: conflicting declaration of C function
‘const char* strsignal(int)’
  555 | extern const char *strsignal (int);
  |^
In file included from
/Users/devel/ibin/prev-x86_64-apple-darwin21.2.0/libstdc++-v3/include/cstring:42,
 from ../../gcc/gcc/system.h:241,
 from ../../gcc/gcc/genmodes.c:21:
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/string.h:134:10:
note: previous declaration ‘char* strsignal(int)’
  134 | char*strsignal(int __sig);
  |  ^
make[3]: *** [build/genmodes.o] Error 1
make[2]: *** [all-stage2-gcc] Error 2
make[1]: *** [stage2-bubble] Error 2
make: *** [all] Error 2



The configure line is: configure --prefix=$HOME/irun
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
--with-gmp=/usr/local/opt --enable-languages=all

[Bug tree-optimization/103816] [12 Regression] ICE: in vect_build_slp_tree_2, at tree-vect-slp.c:1748 since r12-1551-g3dfa4fe9f1a089b2

2021-12-23 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103816

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
  Known to work||11.2.0
  Component|c   |tree-optimization
   Target Milestone|--- |12.0
  Known to fail||12.0
   Last reconfirmed||2021-12-23
 CC||marxin at gcc dot gnu.org,
   ||rguenth at gcc dot gnu.org
 Ever confirmed|0   |1
Summary|ICE: in |[12 Regression] ICE: in
   |vect_build_slp_tree_2, at   |vect_build_slp_tree_2, at
   |tree-vect-slp.c:1748|tree-vect-slp.c:1748 since
   ||r12-1551-g3dfa4fe9f1a089b2

--- Comment #1 from Martin Liška  ---
Started with r12-1551-g3dfa4fe9f1a089b2.

[Bug c/103816] New: ICE: in vect_build_slp_tree_2, at tree-vect-slp.c:1748

2021-12-23 Thread k.even-mendoza at imperial dot ac.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103816

Bug ID: 103816
   Summary: ICE: in vect_build_slp_tree_2, at tree-vect-slp.c:1748
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: k.even-mendoza at imperial dot ac.uk
  Target Milestone: ---

This program crashed with GCC-12 with -O2 and -O3:

typedef enum { e } f;
struct {
  f __attribute__((mode(__byte__))) a;
  f __attribute__((mode(__byte__))) b;
  f __attribute__((mode(__byte__))) c;
  f __attribute__((mode(__byte__))) d
} g[];
void main() { g[0].b = (g[0].b & g[4].b) * g[2305843009213693952].c; }


This code works fine with GCC-11. I tried several versions of GCC-12: 20211023,
2028, and 20211216 on Ubuntu-18.

The trace looks like this:
===
fuzzer-file-54092.c:7:1: warning: no semicolon at end of struct or union
7 | } g[];
  | ^
fuzzer-file-54092.c:7:3: warning: array ‘g’ assumed to have one element
7 | } g[];
  |   ^
during GIMPLE pass: slp
fuzzer-file-54092.c: In function ‘main’:
fuzzer-file-54092.c:8:6: internal compiler error: in vect_build_slp_tree_2, at
tree-vect-slp.c:1748
8 | void main() { g[0].b = (g[0].b & g[4].b) * g[2305843009213693952].c; }
  |  ^~~~
0x7d2c1c vect_build_slp_tree_2
.././../gcc-source/gcc/tree-vect-slp.c:1748
0x119b89d vect_build_slp_tree
.././../gcc-source/gcc/tree-vect-slp.c:1549
0x119fe30 vect_build_slp_instance
.././../gcc-source/gcc/tree-vect-slp.c:3025
0x11a5966 vect_analyze_slp(vec_info*, unsigned int)
.././../gcc-source/gcc/tree-vect-slp.c:3388
0x11aa0ea vect_slp_analyze_bb_1
.././../gcc-source/gcc/tree-vect-slp.c:5762
0x11aa0ea vect_slp_region
.././../gcc-source/gcc/tree-vect-slp.c:5864
0x11aa0ea vect_slp_bbs
.././../gcc-source/gcc/tree-vect-slp.c:6056
0x11ac131 vect_slp_function(function*)
.././../gcc-source/gcc/tree-vect-slp.c:6144
0x11b36e2 execute
.././../gcc-source/gcc/tree-vectorizer.c:1503
Please submit a full bug report,

[Bug c++/52830] ICE: "canonical types differ for identical types ..." when attempting SFINAE with member type

2021-12-23 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52830

Patrick Palka  changed:

   What|Removed |Added

   Target Milestone|--- |12.0
 Resolution|--- |FIXED
 CC||ppalka at gcc dot gnu.org
 Status|REOPENED|RESOLVED

--- Comment #15 from Patrick Palka  ---
(In reply to Jason Merrill from comment #14)
> This seems to be fixed on trunk.

Looks like ever since r12-3766, which also removed the dg-ice from
constexpr-52830.C, so I suppose we can close this PR then.

[Bug middle-end/57955] [9/10/11/12 Regression] Uniquization of constants reduces alignment of initializers

2021-12-23 Thread dje at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57955

--- Comment #26 from David Edelsohn  ---
As Bill mentioned, one can increase the alignment of a large constant, but
there is no way for the hooks that set alignment to recognize that the constant
will be assigned to variable with stricter alignment.

[Bug ada/79724] GNAT tools do not respect --program-suffix and --program-prefix

2021-12-23 Thread fxcoudert at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79724

--- Comment #4 from Francois-Xavier Coudert  ---
The current situation is the result of
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=864
Comment 20 by Dave Korn (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=864#c20)
is spot on:

> ... means that it only recognizes a suffix if there is also a prefix, i.e. it 
> only
> works for cross-compilers.  The documentation suggests this is deliberate:
> [...]
> but why?  The native behaviour is wrong and it seems incorrect to me that
> it should have different semantics from the cross-compiler case.

As far as I can see, this comment from 2011 was never addressed, and the bug
was closed. This is what is biting us, this logic needs to be improved.

The simplest patch is to detect suffix in all cases, as far as I can see one
only needs to remove the test:


diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index cf39128fb7b..9a578a62273 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -2286,9 +2286,7 @@ package body Osint is
  end if;
   end loop;

-  if End_Of_Prefix > 1 then
- Start_Of_Suffix := End_Of_Prefix + Prog'Length + 1;
-  end if;
+  Start_Of_Suffix := End_Of_Prefix + Prog'Length + 1;

   --  Create the new program name


And with this patch I get the expected result:

$ gnatmake-11 hello.adb 
gcc-11 -c hello.adb
gnatbind-11 -x hello.ali
gnatlink-11 hello.ali

[Bug ada/79724] GNAT tools do not respect --program-suffix and --program-prefix

2021-12-23 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79724

Eric Gallager  changed:

   What|Removed |Added

 CC||egallager at gcc dot gnu.org

--- Comment #3 from Eric Gallager  ---
MacPorts also configures with --program-suffix so if we ever wanted to add ada
support there, this would block that, too.

[Bug c/48110] "fast" and "g" should be aliases of "Ofast" and "Og" inside optimize attribute

2021-12-23 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48110

Eric Gallager  changed:

   What|Removed |Added

 CC||egallager at gcc dot gnu.org,
   ||roger at nextmovesoftware dot 
com

--- Comment #5 from Eric Gallager  ---
Hm, I wonder if this affects the new -Oz switch, too...

[Bug c/103815] New: Misoptimization of a bounded do/while loop

2021-12-23 Thread matthias at urlichs dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103815

Bug ID: 103815
   Summary: Misoptimization of a bounded do/while loop
   Product: gcc
   Version: og10 (devel/omp/gcc-10)
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: matthias at urlichs dot de
  Target Milestone: ---

This code, which calculates an integer square root ..:

#include 
uint16_t int_sqrt32(uint32_t x)
{
uint16_t res=0;
uint16_t add= 0x8000;   
do {
uint16_t temp=res | add;
uint32_t g2=temp*temp;  
if (x>=g2)
res=temp;   
add>>=1;
} while(add);
return res;
}

... should be compileable 1:1, since the right shift sets the condition flags
appropriately.

Unfortunately, GCC's optimizer notices that this is a 16-step loop, "helpfully"
invents a loop counter, and pessimizes the code to this sub-optimal result (ARM
Thumb output; x86 has essentially the same problem):

   0:   b500push{lr}
   2:   2110movsr1, #16
   4:   4686mov lr, r0
   6:   f44f 4200   mov.w   r2, #32768  ; 0x8000
   a:   2000movsr0, #0
   c:   ea40 0302   orr.w   r3, r0, r2
  10:   0852lsrsr2, r2, #1
  12:   b29buxthr3, r3
  14:   fb03 fc03   mul.w   ip, r3, r3
  18:   45f4cmp ip, lr
  1a:   bf98it  ls
  1c:   4618movls   r0, r3
  1e:   3901subsr1, #1
  20:   d1f4bne.n   c 
  22:   f85d fb04   ldr.w   pc, [sp], #4

[Bug c++/92944] [concepts] redefinition error when using constrained structure template inside namespace

2021-12-23 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92944

Patrick Palka  changed:

   What|Removed |Added

 CC||florin at iucha dot net

--- Comment #3 from Patrick Palka  ---
*** Bug 103809 has been marked as a duplicate of this bug. ***

[Bug c++/103809] wrong reporting of (template) struct redefinition when doing a more constrained template outside of the namespace

2021-12-23 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103809

Patrick Palka  changed:

   What|Removed |Added

 CC||ppalka at gcc dot gnu.org
 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #2 from Patrick Palka  ---
dup

*** This bug has been marked as a duplicate of bug 92944 ***

[Bug target/103773] wrong code at -Oz due to sign extension

2021-12-23 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103773

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Roger Sayle :

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

commit r12-6106-gef26c151c14a87177d46fd3d725e7f82e040e89f
Author: Roger Sayle 
Date:   Thu Dec 23 12:33:07 2021 +

x86: PR target/103773: Fix wrong-code with -Oz from pop to memory.

This is a fix to PR target/103773 where -Oz shouldn't use push/pop
on x86 to shrink writing small integer constants to memory.
Instead clang uses "andl $0, mem" for writing zero, and "orl $-1, mem"
when writing -1 to memory when using -Oz.  This patch implements this
via peephole2 where we can confirm that its ok to clobber the flags.

2021-12-23  Roger Sayle  
Uroš Bizjak  

gcc/ChangeLog
PR target/103773
* config/i386/i386.md (*mov_and): New define_insn for
writing a zero to memory using AND.
(*mov_or): Extend to allow memory destination and HImode.
(*movdi_internal): Remove -Oz push/pop optimization from here.
(*movsi_internal): Likewise.
(peephole2): Perform -Oz push/pop optimization here, only for
register destinations, values other than zero, and in functions
that don't used the red zone.
(peephole2): With -Oz, convert writes of 0 or -1 to memory into
their clobber forms, i.e. *mov_and and *mov_or resp.

gcc/testsuite/ChangeLog
PR target/103773
* gcc.target/i386/pr103773-2.c: New test case.
* gcc.target/i386/pr103773.c: New test case.

[Bug c++/98662] checking ICE in friend_accessible_p since r227023

2021-12-23 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98662

Martin Liška  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #2 from Martin Liška  ---
Started with r6-2860-g7ac2c0bd17900b3c.

[Bug tree-optimization/103797] Clang vectorized LightPixel while GCC does not

2021-12-23 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103797

--- Comment #17 from Uroš Bizjak  ---
(In reply to hubicka from comment #16)
> > > 
> > > It could be done, but I was under impression that the sequence to load 
> > > 1.0f
> > > into topmost elements nullifies the benefit of operation to divide two
> > 
> > Sure, so perhaps we should somewhat increase the vectorization cost of 
> > V2SFmode
> > division so that we would use it only if it is part of longer sequences?
> 
> I wonder how the hardware implements it.  If divps is of similar latency
> as divss then I guess it is essentially always win to load 1.0 to the
> upper part, since it is slow operation.  On the other hand if divps is
> about 4 times divss, then this may be harmful.
> 
> Agner Fog seems to be listing divss and divps with same latencies.
> For zen it is 10 cycles which should be enough to do the setup.

OK, I'll prepare and test a formal patch.

[Bug middle-end/57955] [9/10/11/12 Regression] Uniquization of constants reduces alignment of initializers

2021-12-23 Thread ebotcazou at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57955

--- Comment #25 from Eric Botcazou  ---
> Before the gimplification change the initializer {1,} was promoted to a
> static const and given an alignment of 128; due to this part of the code:
> 
> if (align > DECL_ALIGN (new_tree))
>   {
> DECL_ALIGN (new_tree) = align;
> DECL_USER_ALIGN (new_tree) = 1;
>   }
> 
> But now it just uses DATA_ALIGNMENT (the code should be using
> TARGET_CONSTANT_ALIGNMENT but does not right now, that was a proposal).

Yes, exactly.  The initializer is put into the "tree" constant pool, where its
alignment is uniformly set to DATA_ALIGNMENT.

[Bug ada/79724] GNAT tools do not respect --program-suffix and --program-prefix

2021-12-23 Thread fxcoudert at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79724

--- Comment #2 from Francois-Xavier Coudert  ---
It's puzzling, because although I've never read any Ada code, I can see there
is some logic in place that should deal with it. In make.adb there is:

   Gcc  : String_Access := Program_Name ("gcc", "gnatmake");
   Gnatbind : String_Access := Program_Name ("gnatbind", "gnatmake");
   Gnatlink : String_Access := Program_Name ("gnatlink", "gnatmake");

and in osint.adb the function Program_Name has some logic to find prefix and
suffix:

  --  Find the target prefix if any, for the cross compilation case.
  --  For instance in "powerpc-elf-gcc" the target prefix is
  --  "powerpc-elf-"
  --  Ditto for suffix, e.g. in "gcc-4.1", the suffix is "-4.1"

and it uses them to return the program that is going to be used:

  --  Create the new program name

  return new String'
(Name_Buffer (Start_Of_Prefix .. End_Of_Prefix)
 & Nam
 & Name_Buffer (Start_Of_Suffix .. Name_Len));

I tried to debug this by sticking some Ada.Text_IO.Put_Line calls, but either
I'm doing it wrong, or it's never actually called.

[Bug ada/79724] GNAT tools do not respect --program-suffix and --program-prefix

2021-12-23 Thread fxcoudert at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79724

Francois-Xavier Coudert  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 CC||charlet at adacore dot com,
   ||derodat at adacore dot com,
   ||fxcoudert at gcc dot gnu.org
Summary|please respect calling gnat |GNAT tools do not respect
   |tools configured with   |--program-suffix and
   |--program-suffix and|--program-prefix
   |--program-prefix|
   Last reconfirmed||2021-12-23
 Status|UNCONFIRMED |NEW

--- Comment #1 from Francois-Xavier Coudert  ---
Confirmed. This is blocking Ada integration into Homebrew:
https://github.com/Homebrew/homebrew-core/pull/77641

We configure GCC with:
configure --prefix=/tmp/irun --enable-languages=all --program-suffix=-11

This leads to the installation of suffixed gnat tools:

meau /tmp/irun $ ls bin/gnat*
bin/gnat-11  bin/gnatchop-11  bin/gnatkr-11bin/gnatls-11   
bin/gnatname-11
bin/gnatbind-11  bin/gnatclean-11 bin/gnatlink-11  bin/gnatmake-11 
bin/gnatprep-11

But they're not usable:

meau /tmp/irun $ gnatmake-11 hello.adb
gcc -c hello.adb
clang: error: unknown argument: '-gnatea'
clang: error: unknown argument: '-gnatez'
gnatmake-11: "hello.adb" compilation error

because gnatmake-11 is calling the unsuffixed `gcc`, which does not support
Ada.
(On macOS, this system compiler is a wrapper to clang.)

Even if I try to add some options to gnatmake, it will still somehow fail,
because the relevant options are not passed down to gnatlink:

meau /tmp/irun $ gnatmake-11 hello.adb --GCC=gcc-11 --GNATBIND=gnatbind-11
--GNATLINK=gnatlink-11
gcc-11 -c hello.adb
gnatbind-11 -x hello.ali
gnatlink-11 hello.ali
clang: error: unknown argument: '-gnatA'
clang: error: unknown argument: '-gnatWb'
clang: error: unknown argument: '-gnatiw'
clang: error: unknown argument: '-gnatws'
gnatmake-11: *** link failed.

[Bug tree-optimization/98552] Make more use of __builtin_undefined for assuring that variables do not change

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98552

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-12-23

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

[Bug tree-optimization/98598] Missed opportunity to optimize dependent loads in loops

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98598

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug c++/98662] checking ICE in friend_accessible_p since r227023

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98662

--- Comment #1 from Andrew Pinski  ---
Before GCC 6, we accepted the code.

[Bug tree-optimization/103797] Clang vectorized LightPixel while GCC does not

2021-12-23 Thread hubicka at kam dot mff.cuni.cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103797

--- Comment #16 from hubicka at kam dot mff.cuni.cz ---
> > 
> > It could be done, but I was under impression that the sequence to load 1.0f
> > into topmost elements nullifies the benefit of operation to divide two
> 
> Sure, so perhaps we should somewhat increase the vectorization cost of 
> V2SFmode
> division so that we would use it only if it is part of longer sequences?

I wonder how the hardware implements it.  If divps is of similar latency
as divss then I guess it is essentially always win to load 1.0 to the
upper part, since it is slow operation.  On the other hand if divps is
about 4 times divss, then this may be harmful.

Agner Fog seems to be listing divss and divps with same latencies.
For zen it is 10 cycles which should be enough to do the setup.

[Bug c++/91008] error redeclaring the same type involving a non-type template argument

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91008

Andrew Pinski  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |11.0

--- Comment #5 from Andrew Pinski  ---
(In reply to Martin Liška from comment #4)
> Fixed with r11-8207-g89c863488bc8c731.

That patch is fixing this testcase explictly.

[Bug c++/98523] Bug with class static definition and non-type template parameters

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98523

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
  Known to fail||4.1.2
   Last reconfirmed||2021-12-23
 Status|UNCONFIRMED |NEW

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

[Bug c++/98450] Inconsistent Wunused-variable warning for std::array

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98450

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
  Known to fail||12.0
 Ever confirmed|0   |1
   Last reconfirmed||2021-12-23

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

[Bug libstdc++/102221] Missed optimizations for algorithms over std::unique_ptr

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102221

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||alias
   Severity|normal  |enhancement

[Bug tree-optimization/103797] Clang vectorized LightPixel while GCC does not

2021-12-23 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103797

--- Comment #15 from Jakub Jelinek  ---
(In reply to Uroš Bizjak from comment #12)
> (In reply to Jakub Jelinek from comment #10)
> > At least on your short testcase clang doesn't use divps either.
> > We do support mulv2sf3, addv2sf3 etc. but not divv2sf3 I bet because with
> > TARGET_MMX_WITH_SSE it would divide by zero in the 3rd and 4th elts,
> > but perhaps we could insert 1.0f, 1.0f into those elements of the divisor
> > before using divps?
> 
> It could be done, but I was under impression that the sequence to load 1.0f
> into topmost elements nullifies the benefit of operation to divide two

Sure, so perhaps we should somewhat increase the vectorization cost of V2SFmode
division so that we would use it only if it is part of longer sequences?

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

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
Bug 103524 depends on bug 103814, which changed state.

Bug 103814 Summary: Internal error while compiling concepts, exception and 
fstream modules.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103814

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

[Bug c++/67491] [meta-bug] concepts issues

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
Bug 67491 depends on bug 103814, which changed state.

Bug 103814 Summary: Internal error while compiling concepts, exception and 
fstream modules.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103814

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

[Bug c++/99244] [modules] ICE in tsubst_copy, at cp/pt.c:16581

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99244

Andrew Pinski  changed:

   What|Removed |Added

 CC||samuel.hangouet at gmail dot 
com

--- Comment #4 from Andrew Pinski  ---
*** Bug 103814 has been marked as a duplicate of this bug. ***

[Bug c++/103814] Internal error while compiling concepts, exception and fstream modules.

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103814

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Andrew Pinski  ---
Dup of bug 99244.

*** This bug has been marked as a duplicate of bug 99244 ***

[Bug tree-optimization/103797] Clang vectorized LightPixel while GCC does not

2021-12-23 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103797

--- Comment #14 from Uroš Bizjak  ---
(In reply to Uroš Bizjak from comment #13)
> Created attachment 52051 [details]
> Patch that implements v2sf division

This patch also enables vectorization of the testcase from Comment #7. Using
-ffast-math, it also generates vectorized reciprocal:

movss   f(%rip), %xmm4
movss   test+8(%rip), %xmm3
movqtest(%rip), %xmm2
mulss   %xmm4, %xmm3
movaps  %xmm4, %xmm0
shufps  $0xe0, %xmm0, %xmm0
mulps   %xmm0, %xmm2
movhps  .LC0(%rip), %xmm0
--> rcpps   %xmm0, %xmm1
sqrtss  %xmm3, %xmm3
mulps   %xmm1, %xmm0
sqrtps  %xmm2, %xmm2
divss   %xmm4, %xmm3
movaps  %xmm2, %xmm5
mulps   %xmm1, %xmm0
addps   %xmm1, %xmm1
subps   %xmm0, %xmm1
mulps   %xmm1, %xmm5
movlps  %xmm5, test(%rip)
movss   %xmm3, test+8(%rip)
ret

[Bug tree-optimization/103797] Clang vectorized LightPixel while GCC does not

2021-12-23 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103797

--- Comment #13 from Uroš Bizjak  ---
Created attachment 52051
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52051&action=edit
Patch that implements v2sf division

Please try the attached patch, for the following testcase:

--cut here--
float a[2], b[2], r[2];

void bar (void)
{
  int i;

  for (i = 0; i < 2; i++)
r[i] = a[i] / b[i];
}
--cut here--

the compiler generates:

movqb(%rip), %xmm1
movqa(%rip), %xmm0
movhps  .LC0(%rip), %xmm1
divps   %xmm1, %xmm0
movlps  %xmm0, r(%rip)
ret

[Bug c++/103814] New: Internal error while compiling concepts, exception and fstream modules.

2021-12-23 Thread samuel.hangouet at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103814

Bug ID: 103814
   Summary: Internal error while compiling concepts, exception and
fstream modules.
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: samuel.hangouet at gmail dot com
  Target Milestone: ---

To reproduce, just type:

rm -rf ./gcm.cache
g++-11 -fmodules-ts -std=c++20 -x c++-system-header concepts
g++-11 -fmodules-ts -std=c++20 -x c++-system-header exception
g++-11 -fmodules-ts -std=c++20 -x c++-system-header fstream

Here is the resulting error message:


In file included from /usr/include/c++/11/bits/nested_exception.h:40,
 from /usr/include/c++/11/exception:148,
of module /usr/include/c++/11/exception, imported at
/usr/include/c++/11/ios:39,
included from /usr/include/c++/11/istream:38,
 from /usr/include/c++/11/fstream:38:
/usr/include/c++/11/bits/move.h: In instantiation of ‘constexpr
std::_Require >,
std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&,
_Tp&) [with _Tp = _IO_FILE*;
std::_Require >,
std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > = void]’:
/usr/include/x86_64-linux-gnu/c++/11/bits/basic_file.h:79:11:   required from
here
/usr/include/c++/11/bits/move.h:204:19: internal compiler error: in
tsubst_copy, at cp/pt.c:16660
  204 |   _Tp __tmp = _GLIBCXX_MOVE(__a);
  |   ^
0xe306b3 internal_error(char const*, ...)
???:0
0xe27039 fancy_abort(char const*, int, char const*)
???:0
0x10edb0c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
???:0
0x10ee05d tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
???:0
0x10eefae tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
???:0
0x1178f37 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
???:0
0x117927d tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
???:0
0x1178ffe tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
???:0
0x1178f95 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
???:0
0x122150a instantiate_decl(tree_node*, bool, bool)
???:0
0xfa3850 instantiate_pending_templates(int)
???:0
0xf9f8f3 c_parse_final_cleanups()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

I'm using standard g++-11 shipped with ubuntu 20.04 :

$ g++-11 -v
Using built-in specs.
COLLECT_GCC=g++-11
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
11.1.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --disable-cet
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-11-2V7zgg/gcc-11-11.1.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-2V7zgg/gcc-11-11.1.0/debian/tmp-gcn/usr
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Ubuntu 11.1.0-1ubuntu1~20.04)

[Bug middle-end/103813] [11/12 Regression] Crash in decompose, at wide-int.h:984 fold-const since r11-5271-g4866b2f5db117f9e

2021-12-23 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103813

Martin Liška  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org
Summary|[11/12 Regression] Crash in |[11/12 Regression] Crash in
   |decompose, at   |decompose, at
   |wide-int.h:984 fold-const   |wide-int.h:984 fold-const
   ||since
   ||r11-5271-g4866b2f5db117f9e

--- Comment #4 from Martin Liška  ---
Started with r11-5271-g4866b2f5db117f9e.

[Bug target/103808] [12 Regression] '-fcompare-debug' failure (length) w/ -O2 -ftrapv since r12-5944-ga7acb6dca941db2b

2021-12-23 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103808

Martin Liška  changed:

   What|Removed |Added

   Keywords|needs-bisection |
Summary|[12 Regression] |[12 Regression]
   |'-fcompare-debug' failure   |'-fcompare-debug' failure
   |(length) w/ -O2 -ftrapv |(length) w/ -O2 -ftrapv
   ||since
   ||r12-5944-ga7acb6dca941db2b
 CC||marxin at gcc dot gnu.org,
   ||vmakarov at gcc dot gnu.org

--- Comment #4 from Martin Liška  ---
Example from #c3 started to fail with r12-5944-ga7acb6dca941db2b.

[Bug ipa/103786] Suspicious code in verify_type

2021-12-23 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103786

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #3 from Martin Liška  ---
Fixed.

[Bug ipa/103786] Suspicious code in verify_type

2021-12-23 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103786

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Martin Liska :

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

commit r12-6104-g9ac0730c25b357b5fc75e18677cec27a546c1b64
Author: Feng Xue 
Date:   Tue Dec 21 09:48:16 2021 +0100

Fix typo in type verification.

PR ipa/103786

gcc/ChangeLog:

* tree.c (verify_type): Fix typo.

[Bug tree-optimization/88842] missing optimization CSE, reassociation

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88842

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug tree-optimization/35288] Expression reassociation problem

2021-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35288

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
  Component|middle-end  |tree-optimization
   Keywords||missed-optimization

--- Comment #3 from Andrew Pinski  ---
If we use -fwrapv, then GCC is able to get it. THere might be a dup of this bug
already too.

[Bug tree-optimization/103797] Clang vectorized LightPixel while GCC does not

2021-12-23 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103797

--- Comment #12 from Uroš Bizjak  ---
(In reply to Jakub Jelinek from comment #10)
> At least on your short testcase clang doesn't use divps either.
> We do support mulv2sf3, addv2sf3 etc. but not divv2sf3 I bet because with
> TARGET_MMX_WITH_SSE it would divide by zero in the 3rd and 4th elts,
> but perhaps we could insert 1.0f, 1.0f into those elements of the divisor
> before using divps?

It could be done, but I was under impression that the sequence to load 1.0f
into topmost elements nullifies the benefit of operation to divide two
elements.  However, if the missing pattern prevents longer vectorized chains,
this is not entirely true.

The division can be implemented in the same way as sse_cvtps2pi, but using
CONST1_RTX vector.

[Bug middle-end/59394] Unused code generated

2021-12-23 Thread smal.root at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59394

--- Comment #6 from smalcom  ---
Created attachment 52050
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52050&action=edit
Generated assembly when using "LTO". avr-gcc-10.2

(In reply to Andrew Pinski from comment #4)
> If I use -Wl,--gc-sections -ffunction-sections, then all of the unused
> (non-static) functions are removed.
> 
> Also -flto is able to optimize it too.

I confirm that:
1. With set "-Wl,--gc-sections -ffunction-sections" output file do not contain
unused functions (attached gcsec.lss).
2. With "-flto" all functions are inlined and present only used code (attached
lto.lss).

Tested using gcc-10:

avr-gcc -v
Using built-in specs.
Reading specs from
/mnt/stor5/opt/сборка/avr-10.2.0/bin/../lib/gcc/avr/10.2.0/device-specs/specs-avr2
COLLECT_GCC=avr-gcc
COLLECT_LTO_WRAPPER=/mnt/stor5/opt/сборка/avr-10.2.0/bin/../libexec/gcc/avr/10.2.0/lto-wrapper
Target: avr
Configured with: ../configure --prefix=/opt/toolchain/avr-10.2.0 --target=avr
--enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
Thread model: single
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC) 

Great. Thanks!

[Bug middle-end/59394] Unused code generated

2021-12-23 Thread smal.root at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59394

--- Comment #5 from smalcom  ---
Created attachment 52049
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52049&action=edit
Generated assembly when using "gc-section". avr-gcc-10.2