[Bug tree-optimization/103221] New: evrp removes |SIGN but does not propagate the ssa name

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

Bug ID: 103221
   Summary: evrp removes |SIGN but does not propagate the ssa name
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: enhancement
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
signed char f(signed char a)
{
  signed char v;
  v = a;
  if (a < 0)
v = a | -128;
  return v;
}
 CUT 
EVRP is able to remove the | -128 part but still left with:
  if (a_2(D) < 0)
goto ; [INV]
  else
goto ; [INV]

   :
  v_4 = a_2(D);

   :
  # v_1 = PHI 
  return v_1;

But the PHI should be removed and the function should have been at this point
just "return a_2(D);".

Note this is not a regression and even the original VRP had a similar issue
too.

[Bug tree-optimization/103218] (a < 0) << signbit is not always optimized to a & signbitmask at the gimple level

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

--- Comment #4 from Andrew Pinski  ---
Created attachment 51782
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51782=edit
patch in testing

Patch in testing.

[Bug libffi/102874] [12 regression] src/x86/win64.S doesn't assemble with Solaris as

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

--- Comment #8 from H.J. Lu  ---
The proposed fix should be submitted to GCC and put it in
libffi/LOCAL_PATCHES after it is checked in.

[Bug tree-optimization/103216] missed optimization, phiopt/vrp?

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

--- Comment #4 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #3) 
> I am going to implement this.  I think I only need the first conversion (and
> making sure cond goes away which leads to the second one) which should lead
> to the rest (after having fixed PR 103218 which I am doing first which is
> needed to get the 4th line).

I was right and wrong. I still need to debug match-and-simplify for why ! does
not work in one case, I thought it would.

Also the last 5 steps did not happen either on the gimple level, I filed PR
103220 for that.

[Bug tree-optimization/103220] New: missed casting issue with |/&?

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

Bug ID: 103220
   Summary: missed casting issue with |/&?
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization, TREE
  Severity: enhancement
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
signed char f(unsigned char a)
{
  unsigned char b = a & 127;
  signed char c = (signed char) b;
  signed char d = (signed char) a;
  signed char e = d & -128;
  signed char h = c | e;
  return h;
}

 CUT 
GCC can optimize this at the RTL level to just return a but misses out at the
gimple level.
Found this while working on PR 103216.

[Bug tree-optimization/103216] missed optimization, phiopt/vrp?

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

Andrew Pinski  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

[Bug tree-optimization/103216] missed optimization, phiopt/vrp?

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

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2021-11-13
 Status|UNCONFIRMED |NEW
   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org

--- Comment #3 from Andrew Pinski  ---
  b_3 = a_2(D) & 127;
  c_4 = (signed char) b_3;
  d_5 = (signed char) a_2(D);
  if (d_5 < 0)
goto ; [INV]
  else
goto ; [INV]

   :
  v_7 = c_4 | -128;

   :
  # v_1 = PHI 


  (d<0) ? (c | -128) : c ->
  c | ((d<0) ? -128 : 0) ->
  c | ((d<0) << 7) ->
  c | (d & -128) ->
  (c|d) & c|-128 ->
  ((signed char)(b | a)) & ((singed char)a|128) ->
  ((signed char)((a&128) | a)) & ((singed char)a|128) ->
  ((signed char)a) & ((singed char)a|128) ->
  (signed char)(a & (a|128))-> 
  (signed char)a

Hopefully I did this right.

I am going to implement this.  I think I only need the first conversion (and
making sure cond goes away which leads to the second one) which should lead to
the rest (after having fixed PR 103218 which I am doing first which is needed
to get the 4th line).

[Bug tree-optimization/103219] [12 Regression] ICE Segmentation fault at -O3 (during GIMPLE pass: unrolljam)

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

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |12.0

[Bug tree-optimization/103219] New: [12 Regression] ICE Segmentation fault at -O3 (during GIMPLE pass: unrolljam)

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

Bug ID: 103219
   Summary: [12 Regression] ICE Segmentation fault at -O3 (during
GIMPLE pass: unrolljam)
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi all.

I am not sure whether there is a dup but it appears to be a recent regression
issue.

$cat small.c
int a, b, c, e;
int d[10];
int main() {
  if (c)
if (f()) {
  g();
  if (e) {
a = 0;
for (; a != 6; a = a + 2) {
  b = 0;
  for (; b <= 3; b++)
d[b] &= 1;
}
  }
}
  return 0;
}

$gcc -w -O3
during GIMPLE pass: unrolljam
small.c: In function ‘main’:
small.c:3:5: internal compiler error: Segmentation fault
3 | int main() {
  | ^~~~
0xc290af crash_signal
../../gcc/toplev.c:322
0x17bfea7 tree_loop_unroll_and_jam
../../gcc/gimple-loop-jam.c:596
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


$gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/gcc/build/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:../configure
--prefix=/home/haoxin/haoxin-data/dut-research/compilers/gcc/build/
--enable-bootstrap --enable-checking=release --enable-languages=c,c++
--enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 2022 (experimental) (GCC) 

Can also check here: https://godbolt.org/z/r7TKr8MxW


Thanks,
Haoxin

[Bug tree-optimization/103218] (a < 0) << signbit is not always optimized to a & signbitmask at the gimple level

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

--- Comment #3 from Andrew Pinski  ---
There is code in fold_ternary_loc which does:
  /* A < 0 ?  : 0 is simply (A & ).  */

And this works as fold also does (a<0)<

[Bug tree-optimization/103218] (a < 0) << signbit is not always optimized to a & signbitmask at the gimple level

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2021-11-13
 Status|UNCONFIRMED |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Andrew Pinski  ---
Note another testcase:
signed char  f(signed char a)
{
if (a < 0)
  return 1u<<7;
return 0;
}

PHIOPT does convert it to:
  _4 = a_2(D) < 0;
  _5 = (signed char) _4;
  _6 = _5 << 7;

But then nothing converts it into:
  _6 = a_2(D) & 128;


Let me see what I can do.

[Bug tree-optimization/103216] missed optimization, phiopt/vrp?

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

--- Comment #2 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #1)
> For x86_64 we might be able to solve this at the RTL level during combine:
> (set (reg/v:QI 84 [  ])
> (if_then_else:QI (lt (subreg:QI (reg:SI 86 [ a ]) 0)
> (const_int 0 [0]))
> (ior:QI (subreg:QI (reg:SI 86 [ a ]) 0)
> (const_int -128 [0xff80]))
> (reg/v:QI 84 [  ])))
> 
> That is optimize:
> (a < 0) ? a | signbit : b
> to
> (a < 0) ? a : b

That didn't work either because combine could put back into place the lt.

[Bug tree-optimization/103218] (a < 0) << signbit is not always optimized to a & signbitmask at the gimple level

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
Note I noticed this while looking on PR 103216.

[Bug tree-optimization/103218] New: (a < 0) << signbit is not always optimized to a & signbitmask at the gimple level

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

Bug ID: 103218
   Summary: (a < 0) << signbit is not always optimized to a &
signbitmask at the gimple level
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization, TREE
  Severity: enhancement
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
int f(signed char a)
{
  signed char t = a < 0;
  return (unsigned char)(t << 7);
}

At the gimple level we get:
int f(signed char a)
{
  signed char t = a < 0;
  return (unsigned char)(t << 7);
}
But combine is able to it:
Trying 9 -> 10:
9: {r89:QI=r91:SI#0 0>>0x7;clobber flags:CC;}
  REG_DEAD r91:SI
  REG_UNUSED flags:CC
   10: {r90:QI=r89:QI<<0x7;clobber flags:CC;}
  REG_DEAD r89:QI
  REG_UNUSED flags:CC
Successfully matched this instruction:
(parallel [
(set (reg:QI 90)
(and:QI (subreg:QI (reg:SI 91) 0)
(const_int -128 [0xff80])))
(clobber (reg:CC 17 flags))
])
allowing combination of insns 9 and 10
original costs 4 + 4 = 8
replacement cost 4
deferring deletion of insn with uid = 9.
modifying insn i310: {r90:QI=r91:SI#0&0xff80;clobber flags:CC;}
  REG_DEAD r91:SI
  REG_UNUSED flags:CC
deferring rescan insn with uid = 10.

If we had wrote the testcase like:
int f(signed char a)
{
  return (a < 0) << 7;
}

GCC does optimize it to:
(int) NON_LVALUE_EXPR  & 128

[Bug libffi/102874] [12 regression] src/x86/win64.S doesn't assemble with Solaris as

2021-11-12 Thread hp at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102874

Hans-Peter Nilsson  changed:

   What|Removed |Added

 CC||hp at gcc dot gnu.org

--- Comment #7 from Hans-Peter Nilsson  ---
(In reply to H.J. Lu from comment #6)
> (In reply to Richard Biener from comment #5)
> > Upstream bug was filed and fix proposed.  IMHO we don't need to wait and can
> > pull this fix temporarily.
> 
> Is there a pull request to fix it in upstream?

I'll help: there -> https://github.com/libffi/libffi/pull/669

[Bug testsuite/103179] [12 regression] Excess errors in gfortran.dg/do_subscript_3.f90 after r12-5126

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103179

Jan Hubicka  changed:

   What|Removed |Added

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

--- Comment #2 from Jan Hubicka  ---
Fixed.

[Bug tree-optimization/103189] [12 regression] g++.dg/tree-ssa/pta-delete-1.C etc. FAIL

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103189
Bug 103189 depends on bug 103182, which changed state.

Bug 103182 Summary: [12 Regression] Recent change causes code correctness 
regression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103182

   What|Removed |Added

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

[Bug tree-optimization/103182] [12 Regression] Recent change causes code correctness regression

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103182

Jan Hubicka  changed:

   What|Removed |Added

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

--- Comment #7 from Jan Hubicka  ---
fixed.

[Bug libstdc++/103166] [12 regression] wrong dependency on getentropy on newlib-based targets

2021-11-12 Thread hp at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103166

--- Comment #9 from Hans-Peter Nilsson  ---
Elaboration: there may be (newlib) targets (build/test setups) where the
test-setup can't link and thus erroneously gets a "yes" for these functions. 
If that happens for you, look into fixing newlib (like, providing a stub that
returns -1 and sets errno=ENOSYS, which would work for libstdc++ as it has a
fallback option - actually several fallback options).

(Or, make newlib stop declaring functions it doesn't completely provide.)

That was my plan B, thankfully GCC_TRY_COMPILE_OR_LINK did the right thing for
my setup. :)

[Bug tree-optimization/103182] [12 Regression] Recent change causes code correctness regression

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

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Jan Hubicka :

https://gcc.gnu.org/g:2f3d43a35155685b1795b4392e20e1c14a33c38f

commit r12-5221-g2f3d43a35155685b1795b4392e20e1c14a33c38f
Author: Jan Hubicka 
Date:   Sat Nov 13 01:51:25 2021 +0100

Fix wrong code with modref and some builtins.

ipa-modref gets confused by EAF flags of memcpy becuase parameter 1 is
escaping but used only directly.  In modref we do not track values saved to
memory and thus we clear all other flags on each store.  This needs to also
happen when called function escapes parameter.

gcc/ChangeLog:

PR tree-optimization/103182
* ipa-modref.c (callee_to_caller_flags): Fix merging of flags.
(modref_eaf_analysis::analyze_ssa_name): Fix merging of flags.

[Bug libstdc++/103166] [12 regression] wrong dependency on getentropy on newlib-based targets

2021-11-12 Thread hp at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103166

Hans-Peter Nilsson  changed:

   What|Removed |Added

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

--- Comment #8 from Hans-Peter Nilsson  ---
Calling it fixed, as observed for cris-elf applying the same patch at
r12-5056-g3439657b0286.

[Bug libstdc++/103166] [12 regression] wrong dependency on getentropy on newlib-based targets

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

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Hans-Peter Nilsson :

https://gcc.gnu.org/g:60f761c7e54f96a287c73a71d0b09ee2b2f8426d

commit r12-5220-g60f761c7e54f96a287c73a71d0b09ee2b2f8426d
Author: Hans-Peter Nilsson 
Date:   Fri Nov 12 18:04:43 2021 +0100

libstdc++: Use GCC_TRY_COMPILE_OR_LINK for getentropy, arc4random

Since r12-5056-g3439657b0286, there has been a regression in
test results; an additional 100 FAILs running the g++ and
libstdc++ testsuite on cris-elf, a newlib target.  The
failures are linker errors, not finding a definition for
getentropy.  It appears newlib has since 2017-12-03
declarations of getentropy and arc4random, and provides an
implementation of arc4random using getentropy, but provides no
definition of getentropy, not even a stub yielding ENOSYS.
This is similar to what it does for many other functions too.

While fixing newlib (like adding said stub) would likely help,
it still leaves older newlib releases hanging.  Thankfully,
the libstdc++ configury test can be improved to try linking
where possible; using the bespoke GCC_TRY_COMPILE_OR_LINK
instead of AC_TRY_COMPILE.  BTW, I see a lack of consistency;
some tests use AC_TRY_COMPILE and some GCC_TRY_COMPILE_OR_LINK
for no apparent reason, but this commit just amends
r12-5056-g3439657b0286.

libstdc++-v3:
PR libstdc++/103166
* acinclude.m4 (GLIBCXX_CHECK_GETENTROPY,
GLIBCXX_CHECK_ARC4RANDOM):
Use GCC_TRY_COMPILE_OR_LINK instead of AC_TRY_COMPILE.
* configure: Regenerate.

[Bug c/20785] Pragma STDC * (C99 FP) unimplemented

2021-11-12 Thread vincent-gcc at vinc17 dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785

--- Comment #17 from Vincent Lefèvre  ---
(In reply to Pavel M from comment #16)
> Note: The #pragma STDC FENV_ACCESS is unknown and ignored (leading to FP
> issues), however, the __STDC_IEC_559__ is defined to 1. Confused.

Yes, and IMHO, with __STDC_IEC_559__ defined to 1, this is a much more severe
issue. This PR should not be regarded as an enhancement, but as a real bug
(this would be an enhancement only if when __STDC_IEC_559__ is defined to 1,
there would be a lack of optimization).

[Bug tree-optimization/103216] missed optimization, phiopt/vrp?

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

--- Comment #1 from Andrew Pinski  ---
For x86_64 we might be able to solve this at the RTL level during combine:
(set (reg/v:QI 84 [  ])
(if_then_else:QI (lt (subreg:QI (reg:SI 86 [ a ]) 0)
(const_int 0 [0]))
(ior:QI (subreg:QI (reg:SI 86 [ a ]) 0)
(const_int -128 [0xff80]))
(reg/v:QI 84 [  ])))

That is optimize:
(a < 0) ? a | signbit : b
to
(a < 0) ? a : b


And I suspect we need after that)
(a < 0) ? a : a & ~signbit
into:
a

[Bug analyzer/99269] False positive -Wanalyzer-malloc-leak/-Wanalyzer-double-free with -fanalyzer

2021-11-12 Thread npfhrotynz-ptnqh.myvf at noclue dot notk.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99269

Dominique Martinet  changed:

   What|Removed |Added

 CC||npfhrotynz-ptnqh.myvf@noclu
   ||e.notk.org

--- Comment #1 from Dominique Martinet  ---
gcc 11.2.1 20210728 (fc34) does not produce any warning with this, so would be
tempted to say it's been fixed.

[Bug analyzer/103217] New: analyzer false positive on leak warning when using indirect strdup

2021-11-12 Thread npfhrotynz-ptnqh.myvf at noclue dot notk.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103217

Bug ID: 103217
   Summary: analyzer false positive on leak warning when using
indirect strdup
   Product: gcc
   Version: 11.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: npfhrotynz-ptnqh.myvf at noclue dot notk.org
  Target Milestone: ---

Inlining both the reproducer and fanalyzer warning as they are small enough:

--
#include 
#include 
#include 

char *xstrdup(const char *src) {
char *val = strdup(src);
if (!val)
abort();
return val;
}

int main(int argc, char *argv[]) {
char *one = NULL, *two = NULL;
int rc;

while ((rc = getopt(argc, argv, "a:b:")) != -1) {
switch (rc) {
case 'a':
free(one);
one = xstrdup(optarg);
break;
case 'b':
free(two);
two = xstrdup(optarg);
break;
}
}
free(one);
free(two);
return 0;
}
--

--
$ gcc -fanalyzer -o t t.c
t.c: In function ‘main’:
cc1: warning: leak of ‘val’ [CWE-401] [-Wanalyzer-malloc-leak]
  ‘main’: events 1-4
|
|t.c:13:5:
|   13 | int main(int argc, char *argv[]) {
|  | ^~~~
|  | |
|  | (1) entry to ‘main’
|..
|   17 | while ((rc = getopt(argc, argv, "a:b:")) != -1) {
|  |~~~
|  |  |
|  |  (2) following
‘true’ branch (when ‘rc != -1’)...
|   18 | switch (rc) {
|  | ~~
|  | |
|  | (3) ...to here
|..
|   25 | two = xstrdup(optarg);
|  |   ~~~
|  |   |
|  |   (4) calling ‘xstrdup’ from ‘main’
|
+--> ‘xstrdup’: events 5-9
   |
   |6 | char *xstrdup(const char *src) {
   |  |   ^~~
   |  |   |
   |  |   (5) entry to ‘xstrdup’
   |7 | char *val = strdup(src);
   |  | ~~~
   |  | |
   |  | (6) allocated here
   |8 | if (!val)
   |  |~
   |  ||
   |  |(7) assuming ‘val’ is non-NULL
   |  |(8) following ‘false’ branch (when ‘val’ is
non-NULL)...
   |9 | abort();
   |   10 | return val;
   |  |~~~
   |  ||
   |  |(9) ...to here
   |
<--+
|
  ‘main’: event 10
|
|   25 | two = xstrdup(optarg);
|  |   ^~~
|  |   |
|  |   (10) returning to ‘main’ from
‘xstrdup’
|
  ‘main’: event 11
|
|cc1:
| (11): ‘val’ leaks here; was allocated at (6)
|
--

As far as I see the conditions seem to be:
 - there have to be at least two cases and two variables, adding more than two
cases leave the error only on second one; interverting the two makes the error
stay on 2nd. Similarly, using the same variable in both cases makes the error
go away.
 - it has to be strdup, replacing strdup with malloc makes the error go away.
 - it has to be indirected, calling strdup() directly in main (with the same
check/abort) makes the error go away. explicit "inline" attribute does not
change behaviour.
 - it doesn't have to be getopt, but there has to be a function call e.g.
replacing getopt() with a locally defined iteration function keeps the error,
but checking argc/argv directly in the loop makes the error disappear

What's also interesting is the event 11 and "(11): ‘val’ leaks here" that
points to... nothing at all? There's no line number or any code quoted to refer
to. I'm a bit at a loss as to what this could mean, exiting from main? where?

[Bug tree-optimization/103216] New: missed optimization, phiopt/vrp?

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

Bug ID: 103216
   Summary: missed optimization, phiopt/vrp?
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: enhancement
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

signed char f(unsigned char a)
{
  unsigned char b;
  signed char c, d, v;
  b = a & 127;
  c = (signed char) b;
  d = (signed char) a;
  v = c;
  if (d < 0)
v = c | -128;
  return v;
}

This should just be optimized to return (signed char)a;

Reduced from the testcase provided by
https://twitter.com/__phantomderp/status/1459247957904080901 .

[Bug tree-optimization/88443] [meta-bug] bogus/missing -Wstringop-overflow warnings

2021-11-12 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
Bug 88443 depends on bug 103176, which changed state.

Bug 103176 Summary: -foptimize-strlen causes stringop-overflow warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103176

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |WONTFIX

[Bug tree-optimization/103176] -foptimize-strlen causes stringop-overflow warning

2021-11-12 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103176

Martin Sebor  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #4 from Martin Sebor  ---
Thanks for the test case.  The warning is based on the IL below.  In basic
block 16 the result of operator new is assigned to _134, and in basic block 19
the code stores zero at an negative offset from _134.  So the warning is doing
its job here: the invalid statement exists in the emitted program, it just may
be unreachable and GCC can't prove that.

   [local count: 19040066]:
  _82 = len_49 - lastpos.2_4;
  length_83 = (int) _82;
  o ={v} {CLOBBER};
  _134 = operator new (1);   >>> _134
  goto ; [100.00%]
  ...
   [local count: 19040066]:
  MEM[(char *)_134] = 0;
  _85 = length_83 + 1;
  _86 = (unsigned int) _85;
  if (_86 == 0)
goto ; [80.71%]
  else
goto ; [19.29%]

   [local count: 25513689]:
  MEM[(char *)_134 + -1B] = 0;   <<< -Wstringop-overflow
  goto ; [100.00%]

The cause of the warning is in the subString() function where it can't prove
that the length argument won't become negative:

string subString(unsigned begin, int length) const
{
// if start after string
// or no proper substring length
if ((length <= 0) || (begin>=size()))
return string{ "" };
// clamp length to maximal value
if ((length+begin) > size())
length = size()-begin;   <<< length not proven to
become -1

string o;
o.reserve(length+1);

for (int i=0; i

[Bug middle-end/103193] gcc for x86_64: wrong code generation: ucomiss instead of comiss

2021-11-12 Thread joseph at codesourcery dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103193

--- Comment #5 from joseph at codesourcery dot com  ---
On Fri, 12 Nov 2021, rguenth at gcc dot gnu.org via Gcc-bugs wrote:

> /* Simplify comparison of something with itself.  For IEEE
>floating-point, we can only do some of these simplifications.  */
> (for cmp (eq ge le)
>  (simplify
>   (cmp @0 @0)
>   (if (! FLOAT_TYPE_P (TREE_TYPE (@0))
>|| ! HONOR_NANS (@0))
>{ constant_boolean_node (true, type); }
>(if (cmp != EQ_EXPR)
> (eq @0 @0)
> 
> does this.  The folding to == happens unconditionally.  As I understand you
> the condition that applies to the constant folding should apply to the
> folding to EQ as well, which means we effectively need to remove the
> canonicalization to EQ (since when it would be valid we can fold to constant
> true)?

It's invalid with -ftrapping-math because it loses an exception.  With 
-fno-trapping-math, but NaNs supported, you can convert to EQ but can't 
fold to constant true.

[Bug c++/103212] requires expression with lambda inside causes a parse error

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

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||rejects-valid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-11-12
Summary|requires expression with|requires expression with
   |lambda fails|lambda inside causes a
   ||parse error
 Ever confirmed|0   |1

--- Comment #2 from Andrew Pinski  ---
Simplified testcase:
static_assert(requires { [](int){}(0); });

Note even though MSVC parses this code correctly, it still says the
static_assert is valid which is obviously wrong :).

[Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103209

Jan Hubicka  changed:

   What|Removed |Added

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

--- Comment #6 from Jan Hubicka  ---
Fixed.

[Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0

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

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jan Hubicka :

https://gcc.gnu.org/g:4d2d5565a0953eaa829d10006baf007cf33bab89

commit r12-5217-g4d2d5565a0953eaa829d10006baf007cf33bab89
Author: Jan Hubicka 
Date:   Fri Nov 12 23:55:50 2021 +0100

Fix wrong code with pure functions

I introduced bug into find_func_aliases_for_call in handling pure
functions.
Instead of reading global memory pure functions are believed to write
global
memory.  This results in misoptimization of the testcase at -O1.

The change to pta-callused.c updates the template for new behaviour of the
constraint generation. We copy nonlocal memory to calluse which is correct
but
also not strictly necessary because later we take care to add nonlocal_p
flag
manually.

gcc/ChangeLog:

PR tree-optimization/103209
* tree-ssa-structalias.c (find_func_aliases_for_call): Fix
use of handle_rhs_call

gcc/testsuite/ChangeLog:

PR tree-optimization/103209
* gcc.dg/tree-ssa/pta-callused.c: Update template.
* gcc.c-torture/execute/pr103209.c: New test.

[Bug fortran/83646] (PDT) Use statement with PDTs excludes the specific instances.

2021-11-12 Thread aldot at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83646

Bernhard Reutner-Fischer  changed:

   What|Removed |Added

 CC||aldot at gcc dot gnu.org

--- Comment #2 from Bernhard Reutner-Fischer  ---
Seems to compile with 10.3.0 and 11.2.0

$ gfortran-10 -c /tmp/pr83646.f90 -o /tmp/pr.o -W -Wall -Wextra
-fdump-tree-original && gfortran-10 --version | head -n1
/tmp/pr.f90:10:20:

   10 |subroutine sub( a )
  |1
Warning: Unused dummy argument ‘a’ at (1) [-Wunused-dummy-argument]
GNU Fortran (Debian 10.3.0-11) 10.3.0

[Bug ada/103070] ICE in gimple_call_static_chain_flags, at gimple.c:1669

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103070
Bug 103070 depends on bug 103058, which changed state.

Bug 103058 Summary: [12 Regression] ICE in gimple_call_static_chain_flags, at 
gimple.c:1669 when building 527.cam4_r
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103058

   What|Removed |Added

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

[Bug tree-optimization/102943] [12 Regression] Jump threader compile-time hog with 521.wrf_r

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102943
Bug 102943 depends on bug 103058, which changed state.

Bug 103058 Summary: [12 Regression] ICE in gimple_call_static_chain_flags, at 
gimple.c:1669 when building 527.cam4_r
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103058

   What|Removed |Added

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

[Bug middle-end/26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
Bug 26163 depends on bug 103058, which changed state.

Bug 103058 Summary: [12 Regression] ICE in gimple_call_static_chain_flags, at 
gimple.c:1669 when building 527.cam4_r
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103058

   What|Removed |Added

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

[Bug fortran/103058] [12 Regression] ICE in gimple_call_static_chain_flags, at gimple.c:1669 when building 527.cam4_r

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103058

Jan Hubicka  changed:

   What|Removed |Added

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

--- Comment #14 from Jan Hubicka  ---
Fixed.

[Bug tree-optimization/103182] [12 Regression] Recent change causes code correctness regression

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103182

--- Comment #5 from Jan Hubicka  ---
What happens here is that we optimize the loop to memcpy and memcpy EAF flags
coming from fnspec are quite interesting.  The copied argument is marked as
escaping but used only directly.  This is correct but not what modref expects
since it generally punts on tracking anything stored in memory, so it needs to
give up on all other flags which it doesn't.

diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index e999c2c5d1e..c705a67daf7 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -1888,19 +1888,18 @@ callee_to_caller_flags (int call_flags, bool
ignore_stores,
  that is not the same as caller returning it.  */
   call_flags |= EAF_NOT_RETURNED_DIRECTLY
| EAF_NOT_RETURNED_INDIRECTLY;
-  /* TODO: We miss return value propagation.
- Be conservative and if value escapes to memory
- also mark it as escaping.  */
   if (!ignore_stores && !(call_flags & EAF_UNUSED))
 {
+  /* If value escapes we are no longer able to track what happens
+with it because we can read it from the escaped location
+anytime.  */
   if (!(call_flags & EAF_NO_DIRECT_ESCAPE))
-   lattice.merge (~(EAF_NOT_RETURNED_DIRECTLY
-| EAF_NOT_RETURNED_INDIRECTLY
-| EAF_NO_DIRECT_READ
-| EAF_UNUSED));
-  if (!(call_flags & EAF_NO_INDIRECT_ESCAPE))
+   lattice.merge (0);
+  else if (!(call_flags & EAF_NO_INDIRECT_ESCAPE))
lattice.merge (~(EAF_NOT_RETURNED_INDIRECTLY
 | EAF_NO_DIRECT_READ
+| EAF_NO_INDIRECT_READ
+| EAF_NO_INDIRECT_CLOBBER
 | EAF_UNUSED));
 }
   else

[Bug tree-optimization/103215] [12 regression] gcc generates unexpected warnings on libx11-1.7.2: error: array subscript -2 is outside array bounds of

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
Confirmed, though I don't see anywhere in the IR   [(void
*)_and_type + -2B];
I do see:
type_9 =   [(void *)type_3 + -2B];

But type_3 cannot be _and_type there because of a check before hand.

This is definitely VRP/CCP related with maybe jump threading involved.

[Bug c/20785] Pragma STDC * (C99 FP) unimplemented

2021-11-12 Thread pavel.morozkin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785

--- Comment #16 from Pavel M  ---
Note: The #pragma STDC FENV_ACCESS is unknown and ignored (leading to FP
issues), however, the __STDC_IEC_559__ is defined to 1. Confused.

[Bug tree-optimization/103207] [12 Regression] ICE in verify_range, at value-range.cc:385 since r12-4766-g113dab2b9d511f3a

2021-11-12 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103207

--- Comment #3 from Aldy Hernandez  ---
That is, is the overflowed 0 allowed in the switch's case?

[Bug fortran/102368] Failure to compile program using the C_SIZEOF function in ISO_C_BINDING

2021-11-12 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102368

--- Comment #4 from anlauf at gcc dot gnu.org ---
Note: Steve Lionel of Intel thinks the code in comment#0 is invalid.

But nvfortran, flang and crayftn all accept it without complaining.

@Bill: any more detailed thoughts how to resolve this?

[Bug tree-optimization/103215] [12 regression] gcc generates unexpected warnings on libx11-1.7.2: error: array subscript -2 is outside array bounds of

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

--- Comment #2 from Andrew Pinski  ---
>Does double post-increment `if (type-- == name_and_type || type-- == 
>name_and_type)` have defined behaviour?

Yes as the || acts as a sequence point.

My bet is there is a (bad) transformation going on that converts v-- == array
to v == array-1, v-- and that is causing the warnings to show up.

> I think error message is at least incorrectly worded. 

the warning is correct iif array-2 was used and that seems to be the problem
here is that is not used directly but the compiler decides to create it
(incorrectly).

[Bug tree-optimization/103215] [12 regression] gcc generates unexpected warnings on libx11-1.7.2: error: array subscript -2 is outside array bounds of

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

Andrew Pinski  changed:

   What|Removed |Added

  Component|c   |tree-optimization
   Keywords||diagnostic
 CC||pinskia at gcc dot gnu.org
   Target Milestone|--- |12.0

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

2021-11-12 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 67901, which changed state.

Bug 67901 Summary: [concepts] overloading bug when considered more specialized 
vs more constrained
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67901

   What|Removed |Added

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

[Bug c++/67901] [concepts] overloading bug when considered more specialized vs more constrained

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #4 from Andrew Pinski  ---
(In reply to Martin Liška from comment #3)
> Fixed on master with r11-1571-g57b4daf8dc4ed7b6.

Which was also committed on the GCC 10 branch with r10-8343-gc3d4dbc68be14842 .

So fixed.

[Bug tree-optimization/103195] [12 Regression] tfft2 text grows by 70% with -Ofast since r12-5113-gd70ef65692fced7a

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103195

Jan Hubicka  changed:

   What|Removed |Added

 CC||mjambor at suse dot cz

--- Comment #4 from Jan Hubicka  ---
OK, quite surprisingly the code size growth is due to ipa-cp.
Due to early modref, we get two aggregate jump functions:

  value: 0x0, mask: 0xffe0
  VR  [1, -1]
param 3: UNKNOWN
+ Aggregate passed by reference:
+   offset: 0, type: integer(kind=4), CONST: 33554432
  value: 0x0, mask: 0xfffc
  VR  [1, -1]
param 4: CONST:  -> -1
@@ -747,6 +744,8 @@
  value: 0x0, mask: 0xffe0
  VR  [1, -1]
param 3: UNKNOWN
+ Aggregate passed by reference:
+   offset: 0, type: integer(kind=4), CONST: 33554432
  value: 0x0, mask: 0xfffc
  VR  [1, -1]
param 4: CONST:  -> 1

and later we decide to clone:

+   Estimating body: rfft/1
+   Known to be false: op3[ref offset: 0] <= 0, op3[ref offset: 0] == 1,
op3[ref offset: 0] == 2, op3[ref offset: 0] changed
+   size:602 time:9868.835632 nonspec time:9884.134781 loops with known
iterations:0.470881 known strides:0.00
+ - estimates for value 33554432 for param #3 npts[ref offset: 0]:
time_benefit: 109.299, size: 602

so the cost metric says that cloning will speed up the function by 0.1%
however good clonning oportunity seems happy:

+ - considering value 33554432 for param #3 npts, offset: 0 (caller_count: 2)
+ good_cloning_opportunity_p (time: 109.299, size: 602, freq_sum: 16.1818)
-> evaluation: 2937.97, threshold: 500

and we clone

+  Creating a specialized node of rfft/1.
+adding an extra known scalar value  for param #0 x
+adding an extra known scalar value  for param #1 trg
+adding an extra known scalar value  for param #2 ibi
+replacing param #0 x with const 
+replacing param #1 trg with const 
+replacing param #2 ibi with const 

[Bug c++/100055] [10/11/12 Regression] ICE on invalid requires expression

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||lts-rudolph at gmx dot de

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

[Bug c++/96111] checking type of attribute with concepts results in compilation error or ICE

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #5 from Andrew Pinski  ---
Dup of bug 100055.

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

[Bug c++/98939] [C++23] Implement P1787R6 "Declarations and where to find them"

2021-11-12 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98939

--- Comment #2 from Marek Polacek  ---
I'm having trouble with "Default template arguments are now complete-class
contexts":

class C {
  template  struct _List;

  template  struct S; // #1

  template 
  struct S<_Sz, _List<_Uint, _UInts...>>; // #2

  static constexpr bool value = false;
};

#2 wants to lookup_template_class S, but S can contain a DEFERRED_PARSE, so
that's not going to work.  Perhaps we have to delay finish_template_type until
the end of class somehow...

[Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0

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

--- Comment #4 from Martin Liška  ---
Wow, what a bug :P

[Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103209

--- Comment #3 from Jan Hubicka  ---
This is bug I introduced to tree-ssa-structalias where I reversed order of
flags which deterine global memory read and writes. So pure functions are
handled as functions writting global memory but not reading it.  I am very
surprised it took so long to show as wrong code.

diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 153ddf57a61..34fd47fdf47 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4996,7 +4996,7 @@ find_func_aliases_for_call (struct function *fn, gcall
*t)
 reachable from their arguments, but they are not an escape
 point for reachable memory of their arguments.  */
   else if (flags & (ECF_PURE|ECF_LOOPING_CONST_OR_PURE))
-   handle_rhs_call (t, , implicit_pure_eaf_flags, true, false);
+   handle_rhs_call (t, , implicit_pure_eaf_flags, false, true);
   /* If the call is to a replaceable operator delete and results
 from a delete expression as opposed to a direct call to
 such operator, then the effects for PTA (in particular

[Bug libstdc++/103166] [12 regression] wrong dependency on getentropy on newlib-based targets

2021-11-12 Thread hp at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103166

Hans-Peter Nilsson  changed:

   What|Removed |Added

URL||https://gcc.gnu.org/piperma
   ||il/gcc-patches/2021-Novembe
   ||r/584316.html
   Assignee|redi at gcc dot gnu.org|hp at gcc dot gnu.org

--- Comment #6 from Hans-Peter Nilsson  ---
Yoink!

[Bug c/103215] [12 regression] gcc generates unexpected warnings on libx11-1.7.2: error: array subscript -2 is outside array bounds of

2021-11-12 Thread slyfox at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103215

--- Comment #1 from Sergei Trofimovich  ---
Created attachment 51781
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51781=edit
orig.bug.c

Attaching orig.bug.c in case I corrupted original too much.

[Bug middle-end/97048] [meta-bug] bogus/missing -Wstringop-overread warnings

2021-11-12 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97048
Bug 97048 depends on bug 98465, which changed state.

Bug 98465 Summary: Bogus -Wstringop-overread with -std=gnu++20 -O2 and 
std::string::insert
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98465

   What|Removed |Added

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

[Bug middle-end/98465] Bogus -Wstringop-overread with -std=gnu++20 -O2 and std::string::insert

2021-11-12 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98465

Martin Sebor  changed:

   What|Removed |Added

  Known to fail|11.0|
 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #33 from Martin Sebor  ---
With the workaround in r11-7146 the warning should no longer be issued for
std::string::insert.  Thanks to r12-2087 suppression by #pragma GCC diagnostic
works reliably even with inlining in GCC 12, so the warning can also be
suppressed using it.  I'm not working on any other improvements related to the
underlying problem but I think this report can be resolved as fixed in GCC 11
and 12.

[Bug c/103215] New: [12 regression] gcc generates unexpected warnings on libx11-1.7.2: error: array subscript -2 is outside array bounds of

2021-11-12 Thread slyfox at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103215

Bug ID: 103215
   Summary: [12 regression] gcc generates unexpected warnings on
libx11-1.7.2: error: array subscript -2 is outside
array bounds of
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Upstream core:
https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/6d1dc1f6169ebf0ba71785d461bd98129c65c862/src/RdBitF.c#L156

Self-contained example:

// $ cat bug.c
#include 
int extract(char*);
int XReadBitmapFileData (void) {
char name_and_type[255];
for (;;) {
extract (name_and_type);
char * type = strrchr (name_and_type, '_');
if (type) type++; else type = name_and_type;
if (strcmp ("hot", type) == 0) {
if (type-- == name_and_type || type-- == name_and_type) continue;
if (strcmp ("ax_hot", type) == 0) return 1;
}
  }
  return -1;
}


Good:
$ gcc-11.2.0 -Wall -Werror=array-bounds -fno-strict-aliasing -O2 -c bug.c
-o bug.o

Bad:
$ gcc-12.0.0 -Wall -Werror=array-bounds -fno-strict-aliasing -O2 -c bug.c
-o bug.o
bug.c: In function 'XReadBitmapFileData':
bug.c:10:48: error: array subscript -2 is outside array bounds of
'char[9223372036854775807]' [-Werror=array-bounds]
   10 | if (type-- == name_and_type || type-- == name_and_type)
continue;
  |^~
bug.c:4:14: note: at offset [0, 253] into object 'name_and_type' of size 255
4 | char name_and_type[255];
  |  ^
cc1: some warnings being treated as errors

Does double post-increment `if (type-- == name_and_type || type-- ==
name_and_type)` have defined behaviour?

I think error message is at least incorrectly worded. I don't think there is an
out-of-bounds access.

$ LANG=C ./result-2/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/nix/store/w588w2rqb5zrs6d09q3rmqpf7m9259y1-gcc-12.0.0/bin/gcc
COLLECT_LTO_WRAPPER=/nix/store/w588w2rqb5zrs6d09q3rmqpf7m9259y1-gcc-12.0.0/libexec/gcc/x86_64-unknown-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211107 (experimental) (GCC)

[Bug tree-optimization/103202] [12 regression] gcc miscompiles ed-1.17 since r12-3876-g4a960d548b7d7d94

2021-11-12 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103202

Aldy Hernandez  changed:

   What|Removed |Added

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

--- Comment #12 from Aldy Hernandez  ---
fixed

[Bug tree-optimization/103202] [12 regression] gcc miscompiles ed-1.17 since r12-3876-g4a960d548b7d7d94

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

--- Comment #11 from CVS Commits  ---
The master branch has been updated by Aldy Hernandez :

https://gcc.gnu.org/g:264f061997c0a5349cdce6d73f0dc167ac7fc8f4

commit r12-5216-g264f061997c0a5349cdce6d73f0dc167ac7fc8f4
Author: Aldy Hernandez 
Date:   Fri Nov 12 16:08:01 2021 +0100

path solver: Solve PHI imports first for ranges.

PHIs must be resolved first while solving ranges in a block,
regardless of where they appear in the import bitmap.  We went through
a similar exercise for the relational code, but missed these.

Tested on x86-64 & ppc64le Linux.

gcc/ChangeLog:

PR tree-optimization/103202
* gimple-range-path.cc
(path_range_query::compute_ranges_in_block): Solve PHI imports
first.

[Bug c++/103213] Lambda type name overlap

2021-11-12 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103213

Jonathan Wakely  changed:

   What|Removed |Added

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

[Bug tree-optimization/98512] [11/12 Regression] “#pragma GCC diagnostic ignored” ineffective in conjunction with alias attribute

2021-11-12 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98512

Martin Sebor  changed:

   What|Removed |Added

  Known to work||12.0
 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED
  Known to fail|11.0|11.2.0

--- Comment #13 from Martin Sebor  ---
Fixed in GCC 12.  The patch is not suitable for backporting to release
branches.

[Bug middle-end/24639] [meta-bug] bug to track all Wuninitialized issues

2021-11-12 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
Bug 24639 depends on bug 98871, which changed state.

Bug 98871 Summary: Cannot silence -Wmaybe-uninitialized at declaration site
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98871

   What|Removed |Added

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

[Bug middle-end/98871] Cannot silence -Wmaybe-uninitialized at declaration site

2021-11-12 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98871

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
  Known to work||12.0

--- Comment #8 from Martin Sebor  ---
Fixed in GCC 12.  The patch will not be backported to current releases.

[Bug fortran/102043] Wrong array types used for negative stride accesses

2021-11-12 Thread mikael at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102043

--- Comment #12 from Mikael Morin  ---
(In reply to Thomas Koenig from comment #11)
> (In reply to Richard Biener from comment #10)
> 
> > Is there any case where the frontend would make 'data' point into the
> > middle of the array and iteration over the array would end up accessing
> > elements on "both sides"?  Can somebody write a short testcase where that
> > would happen?
> 
> I've tried, but I have been unable to find such a test case, and
> I do not think this can (or should) happen.

I would say it can happen as things stand, when one dimension is accessed going
backward and another going forward.

program main
   implicit none
   integer, dimension :: a(4, 4)
   a = 0
   call s(a(4:1:-1,:))
   if (any(a /= 10)) stop 1
contains
  subroutine s(b)
implicit none
integer, dimension(:,:) :: b
b = 10
  end subroutine s
end program main

[Bug libstdc++/103166] [12 regression] wrong dependency on getentropy on newlib-based targets

2021-11-12 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103166

--- Comment #5 from Jonathan Wakely  ---
There's no other patch as far as I know, so that would be great, thanks.

[Bug c++/100583] [modules] ICE when importing

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

--- Comment #4 from Johel Ernesto Guerrero Peña  ---
As pointed out in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103118#c3:

> What works is including them in a non-module unit translation unit.
> 
> ```C++
> #if defined(__GNUC__) and not defined(__clang__)
> #  include  // Workaround GCC bug 103118.
> #  include// Workaround GCC bug 100583.
> #endif
> import waarudo.geometries;
> import waarudo.numbers;
> import waarudo.quantities;
> #include 
> ```

[Bug c++/103118] [modules] ICE tree check in get_merge_kind at cp/module.cc

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

--- Comment #3 from Johel Ernesto Guerrero Peña  ---
What works is including them in a non-module unit translation unit.

```C++
#if defined(__GNUC__) and not defined(__clang__)
#  include  // Workaround GCC bug 103118.
#  include// Workaround GCC bug 100583.
#endif
import waarudo.geometries;
import waarudo.numbers;
import waarudo.quantities;
#include 
```

[Bug c++/103186] [11/12 Regression] ICE with fold-expression and lambdas as default since r11-7965-g23be03a0f243a084

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

Martin Liška  changed:

   What|Removed |Added

   Keywords|needs-bisection |
 CC||jason at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org
Summary|[11/12 Regression] ICE with |[11/12 Regression] ICE with
   |fold-expression and lambdas |fold-expression and lambdas
   |as default  |as default since
   ||r11-7965-g23be03a0f243a084

--- Comment #8 from Martin Liška  ---
Started with r11-7965-g23be03a0f243a084.

[Bug c++/67901] [concepts] overloading bug when considered more specialized vs more constrained

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

Martin Liška  changed:

   What|Removed |Added

   Keywords|needs-bisection |
 CC||marxin at gcc dot gnu.org

--- Comment #3 from Martin Liška  ---
Fixed on master with r11-1571-g57b4daf8dc4ed7b6.

[Bug c++/96111] checking type of attribute with concepts results in compilation error or ICE

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

Martin Liška  changed:

   What|Removed |Added

   Keywords|needs-bisection |
 CC||marxin at gcc dot gnu.org

--- Comment #4 from Martin Liška  ---
The ICE was fixed with r12-389-gc9b6890d0b6aa030.

[Bug c++/101149] Coroutine compiler error with ternary operator

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

Martin Liška  changed:

   What|Removed |Added

   Keywords|needs-bisection |
 Resolution|--- |FIXED
 CC||marxin at gcc dot gnu.org
 Status|UNCONFIRMED |RESOLVED

--- Comment #2 from Martin Liška  ---
Fixed with r12-3529-g70ee703c479081ac.

[Bug c++/103118] [modules] ICE tree check in get_merge_kind at cp/module.cc

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

--- Comment #2 from Johel Ernesto Guerrero Peña  ---
Or not. I forgot to uncomment uses of the chrono library.

[Bug fortran/102043] Wrong array types used for negative stride accesses

2021-11-12 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102043

--- Comment #11 from Thomas Koenig  ---
(In reply to Richard Biener from comment #10)

> Is there any case where the frontend would make 'data' point into the
> middle of the array and iteration over the array would end up accessing
> elements on "both sides"?  Can somebody write a short testcase where that
> would happen?

I've tried, but I have been unable to find such a test case, and
I do not think this can (or should) happen.

[Bug fortran/102368] Failure to compile program using the C_SIZEOF function in ISO_C_BINDING

2021-11-12 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102368

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #3 from anlauf at gcc dot gnu.org ---
Corrected the logic and submitted:

https://gcc.gnu.org/pipermail/fortran/2021-November/057007.html

[Bug libstdc++/103166] [12 regression] wrong dependency on getentropy on newlib-based targets

2021-11-12 Thread hp at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103166

Hans-Peter Nilsson  changed:

   What|Removed |Added

 CC||hp at gcc dot gnu.org

--- Comment #4 from Hans-Peter Nilsson  ---
I have a patch using GCC_TRY_COMPILE_OR_LINK instead of AC_TRY_COMPILE for
those function, since I foolishly went about to fix this before looking in
bugzilla. :)

Will post once it's successfully past the first point of failure, sparing
others the churn of finding autoconf-2.69 and automake-2.15.1.  Unless a patch
is already posted?

[Bug c++/103118] [modules] ICE tree check in get_merge_kind at cp/module.cc

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

--- Comment #1 from Johel Ernesto Guerrero Peña  ---
To work around this
- Do not include ``.
- Explicitly import a module that exports its definitions when you need to use
the chrono library.

I use the headers above to compile a header unit, which I export from a module
to work around the lack of a standard modules. Apparently, `` is
indirectly included, as using the chrono library works.

[Bug ipa/103211] [12 Regression] 416.gamess crashes after r12-5177-g494bdadf28d0fb35

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103211

--- Comment #5 from Jan Hubicka  ---
There is wrong change in my patch (I mixed up this_looping variable for
looping)
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index b831844afa6..5056850c0a8 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1611,9 +1611,6 @@ propagate_pure_const (void)
  enum pure_const_state_e edge_state = IPA_CONST;
  bool edge_looping = false;

- if (e->recursive_p ())
-   looping = true;
-
  if (e->recursive_p ())
looping = true;

@@ -1800,11 +1797,11 @@ propagate_pure_const (void)
switch (this_state)
  {
  case IPA_CONST:
-   remove_p |= ipa_make_function_const (node, looping, false);
+   remove_p |= ipa_make_function_const (node, this_looping,
false);
break;

  case IPA_PURE:
-   remove_p |= ipa_make_function_pure (node, looping, false);
+   remove_p |= ipa_make_function_pure (node, this_looping, false);
break;

  default:

[Bug ipa/103211] [12 Regression] 416.gamess crashes after r12-5177-g494bdadf28d0fb35

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

--- Comment #4 from Martin Liška  ---
Yes:

grep 'found to' * | grep master
unport.fppized.f.025t.nothrow:Function found to be nothrow: master.0.setfm
unport.fppized.f.084i.pure-const:Function found to be pure: master.0.setfm/8
unport.fppized.f.210t.local-pure-const2:Function found to be pure:
master.0.setfm/8

[Bug c++/84930] Brace-closed initialization of cstring (i.e."abcdefghi") to coresponding aggregate types fails in certain situation

2021-11-12 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84930

--- Comment #9 from Marek Polacek  ---
Comment 3 was fixed in r11-7102.

[Bug ipa/103211] [12 Regression] 416.gamess crashes after r12-5177-g494bdadf28d0fb35

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

--- Comment #3 from hubicka at kam dot mff.cuni.cz ---
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103211
> 
> --- Comment #2 from Martin Liška  ---
> Optimized dump differs for couple of functions in the same way:
> 
> diff -u good bad
> --- good2021-11-12 17:42:36.995947103 +0100
> +++ bad 2021-11-12 17:41:56.728194961 +0100
> @@ -38,7 +38,6 @@
> 
>  ;; Function abrt (abrt_, funcdef_no=10, decl_uid=4338, cgraph_uid=11,
> symbol_order=10) (executed once)
> 
> -Removing basic block 5
>  __attribute__((fn spec (". ")))
>  void abrt ()
>  {
> @@ -350,7 +349,6 @@
>  void setfm (integer(kind=4) * ipar)
>  {
> [local count: 1073741824]:
> -  master.0.setfm (0, ipar_2(D)); [tail call]
>return;
> 
>  }
> 
> maybe the fnspec for master.0.setfm is bad?
> 
> __attribute__((fn spec (". R w ")))
> void master.0.setfm (integer(kind=8) __entry, integer(kind=4) * ipar)
> {
It looks more like pure/const discovery. You should be able to use
-fdump-ipa-all -fdump-tree-all and grep "function found to be" 
either pure or const.

What is body of master.0.setfm. Does it look like it does nothing?

"R" in fnspec means that arg 0 is only read directly and not derefernced.
"w" means that it arg 1 is not escaping.

Honza

Re: [Bug ipa/103211] [12 Regression] 416.gamess crashes after r12-5177-g494bdadf28d0fb35

2021-11-12 Thread Jan Hubicka via Gcc-bugs
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103211
> 
> --- Comment #2 from Martin Liška  ---
> Optimized dump differs for couple of functions in the same way:
> 
> diff -u good bad
> --- good2021-11-12 17:42:36.995947103 +0100
> +++ bad 2021-11-12 17:41:56.728194961 +0100
> @@ -38,7 +38,6 @@
> 
>  ;; Function abrt (abrt_, funcdef_no=10, decl_uid=4338, cgraph_uid=11,
> symbol_order=10) (executed once)
> 
> -Removing basic block 5
>  __attribute__((fn spec (". ")))
>  void abrt ()
>  {
> @@ -350,7 +349,6 @@
>  void setfm (integer(kind=4) * ipar)
>  {
> [local count: 1073741824]:
> -  master.0.setfm (0, ipar_2(D)); [tail call]
>return;
> 
>  }
> 
> maybe the fnspec for master.0.setfm is bad?
> 
> __attribute__((fn spec (". R w ")))
> void master.0.setfm (integer(kind=8) __entry, integer(kind=4) * ipar)
> {
It looks more like pure/const discovery. You should be able to use
-fdump-ipa-all -fdump-tree-all and grep "function found to be" 
either pure or const.

What is body of master.0.setfm. Does it look like it does nothing?

"R" in fnspec means that arg 0 is only read directly and not derefernced.
"w" means that it arg 1 is not escaping.

Honza


[Bug ipa/103211] [12 Regression] 416.gamess crashes after r12-5177-g494bdadf28d0fb35

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

--- Comment #2 from Martin Liška  ---
Optimized dump differs for couple of functions in the same way:

diff -u good bad
--- good2021-11-12 17:42:36.995947103 +0100
+++ bad 2021-11-12 17:41:56.728194961 +0100
@@ -38,7 +38,6 @@

 ;; Function abrt (abrt_, funcdef_no=10, decl_uid=4338, cgraph_uid=11,
symbol_order=10) (executed once)

-Removing basic block 5
 __attribute__((fn spec (". ")))
 void abrt ()
 {
@@ -350,7 +349,6 @@
 void setfm (integer(kind=4) * ipar)
 {
[local count: 1073741824]:
-  master.0.setfm (0, ipar_2(D)); [tail call]
   return;

 }

maybe the fnspec for master.0.setfm is bad?

__attribute__((fn spec (". R w ")))
void master.0.setfm (integer(kind=8) __entry, integer(kind=4) * ipar)
{

[Bug tree-optimization/103202] [12 regression] gcc miscompiles ed-1.17 since r12-3876-g4a960d548b7d7d94

2021-11-12 Thread slyfox at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103202

--- Comment #10 from Sergei Trofimovich  ---
(In reply to Aldy Hernandez from comment #9)
> Created attachment 51780 [details]
> patch in testing

The patch fixed real ed-1.17 test suite as well. Thank you!

[Bug ipa/103211] [12 Regression] 416.gamess crashes after r12-5177-g494bdadf28d0fb35

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

--- Comment #1 from Martin Liška  ---
The following file is miscompiled with:

gfortran -c  -o unport.fppized.o -O2 -march=skylake -g -std=legacy
-fno-aggressive-loop-optimizations unport.fppized.f

[Bug web/103214] Incorrect function signatures for __builtin_ia32_pblendd* instructions

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

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
These builtins should never be used directly, they aren't a supported
interface, which are the intrinsics like _mm_blend_epi32 etc.  The builtins are
just underlying implementation of those intrinsics, and can be added, removed
or changed any time.
So, IMNSHO instead of changing the prototypes in the documentation we should
remove all that documentation from there and clarify what we've been telling
for years, that the __builtin_ia32_* builtins must never be used directly.

[Bug web/103214] New: Incorrect function signatures for __builtin_ia32_pblendd* instructions

2021-11-12 Thread gnugcc at bdwjn dot 33mail.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103214

Bug ID: 103214
   Summary: Incorrect function signatures for
__builtin_ia32_pblendd* instructions
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: web
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gnugcc at bdwjn dot 33mail.com
  Target Milestone: ---

The documentation on
https://gcc.gnu.org/onlinedocs/gcc/x86-Built-in-Functions.html lists the
following two AVX2 functions:

> v4si __builtin_ia32_pblendd128 (v4si,v4si)
> v8si __builtin_ia32_pblendd256 (v8si,v8si)

These instructions take two vectors and an integer mask, so this should be:

> v4si __builtin_ia32_pblendd128 (v4si,v4si,int)
> v8si __builtin_ia32_pblendd256 (v8si,v8si,int)

[Bug middle-end/102997] [12 Regression] 45% 454.calculix regression with LTO+PGO -march=native -Ofast on Zen since r12-4526-gd8edfadfc7a9795b65177a50ce44fd348858e844

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

--- Comment #31 from hubicka at kam dot mff.cuni.cz ---
> It likely was the loop header copying missing on cold loops then.
Yep. It is good we worked that out.

[Bug target/99657] ICE: in extract_insn, at recog.c:2769 with SVE code without -march=+sve

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

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

[Bug target/103206] ICE in insn_default_length, at config/aarch64/aarch64.md:1183

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
(In reply to Richard Biener from comment #1)
> I think we have a duplicate of this - the testcase is invalid unless you
> enable SVE.

Yes PR 99657.  My patch which I submitted already fixes this ICE.

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

[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103175

Jan Hubicka  changed:

   What|Removed |Added

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

--- Comment #8 from Jan Hubicka  ---
Fixed.

[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139

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

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Jan Hubicka :

https://gcc.gnu.org/g:4526ec20f17a6182f754da9460d9d944dd123cc0

commit r12-5201-g4526ec20f17a6182f754da9460d9d944dd123cc0
Author: Jan Hubicka 
Date:   Fri Nov 12 16:34:03 2021 +0100

Fix ICE in tree-ssa-structalias.c

PR tree-optimization/103175
* ipa-modref.c (modref_lattice::merge): Add sanity check.
(callee_to_caller_flags): Make flags adjustment sane.
(modref_eaf_analysis::analyze_ssa_name): Likewise.

[Bug target/93082] macOS Authorization.h needs fixinclude

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

Eric Gallager  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=90835,
   ||https://bugs.llvm.org/show_
   ||bug.cgi?id=44406
 CC||bkorb at gnu dot org,
   ||iains at gcc dot gnu.org,
   ||mikestump at comcast dot net

--- Comment #6 from Eric Gallager  ---
This is hitting me in my fork of Apple's version of gdb; cc-ing Darwin and
fixincludes maintainers

[Bug tree-optimization/103202] [12 regression] gcc miscompiles ed-1.17 since r12-3876-g4a960d548b7d7d94

2021-11-12 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103202

--- Comment #9 from Aldy Hernandez  ---
Created attachment 51780
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51780=edit
patch in testing

[Bug tree-optimization/103202] [12 regression] gcc miscompiles ed-1.17 since r12-3876-g4a960d548b7d7d94

2021-11-12 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103202

Aldy Hernandez  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |aldyh at gcc dot gnu.org

--- Comment #8 from Aldy Hernandez  ---
The problem here is this thread:

[5] Registering jump thread: (13, 11) incoming edge;  (11, 10) nocopy; 

BB11 has this:

=== BB 11 
Imports: n_42  
Exports: n_42  
Relational : (n_45 < n_42)
 [local count: 118111614]:
# np_43 = PHI 
# n_42 = PHI 
# m_31 = PHI <0(13), m_16(4)>
n_45 = n_42 + -1;
if (n_42 != 0)
  goto ; [89.00%]
else
  goto ; [11.00%]

Because of the ordering of the import bitmap, we solve m_31 first to 0.  Then,
when we solve n_42, we think we can use the m_31 in the cache, but the ordering
is wrong.

PHIs must always be done first.  We went through a similar exercise to get
relationals right and somehow missed this.

[Bug c++/84930] Brace-closed initialization of cstring (i.e."abcdefghi") to coresponding aggregate types fails in certain situation

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

Will Wray  changed:

   What|Removed |Added

 CC||wjwray at gmail dot com

--- Comment #8 from Will Wray  ---
This can be marked RESOLVED, fixed in gcc11, same as the referenced duplicates.

[Bug target/103201] [12 Regression] trunk 20211111 ftbfs for amdgcn – libgomp/teams.c:49:6: error: 'struct gomp_thread' has no member named 'num_teams'

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

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

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

commit r12-5200-gf49c7a4fb23d82c89c97acec88770b300c903d9a
Author: Jakub Jelinek 
Date:   Fri Nov 12 16:11:02 2021 +0100

libgomp: Unbreak gcn offload build

My recent libgomp change apparently broke libgomp build for gcn offloading.
The problem is that gcn, unlike nvptx, doesn't override teams.c source file
and the patch I've committed assumed all the non-LIBGOMP_USE_PTHREADS
targets
do not use it.  My understanding is that gcn included omp_get_num_teams
and omp_get_team_num definitions in both icv-device.o and teams.o,
with the definitions only in the former working correctly.

This patch brings gcn into sync with how nvptx does it, that teams.c
is overridden, provides a dummy GOMP_teams_reg and
omp_get_{num_teams,team_num}
definitions and icv-device.c doesn't provide those.

2021-11-12  Jakub Jelinek  

PR target/103201
* config/gcn/icv-device.c (omp_get_num_teams, omp_get_team_num):
Move
to ...
* config/gcn/teams.c: ... here.  New file.

[Bug target/103201] [12 Regression] trunk 20211111 ftbfs for amdgcn – libgomp/teams.c:49:6: error: 'struct gomp_thread' has no member named 'num_teams'

2021-11-12 Thread ams at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103201

--- Comment #3 from Andrew Stubbs  ---
I did some preliminary testing on your patch: the libgomp.c/target-teams-1.c
testcase runs fine on amdgcn. I presume that that covers most of the existing
features of those runtime calls?

[Bug other/89863] [meta-bug] Issues in gcc that other static analyzers (cppcheck, clang-static-analyzer, PVS-studio) find that gcc misses

2021-11-12 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89863
Bug 89863 depends on bug 89259, which changed state.

Bug 89259 Summary: liboffloadmic/runtime/offload_omp_host.cpp:692: pointless 
test ?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89259

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |WONTFIX

[Bug other/89259] liboffloadmic/runtime/offload_omp_host.cpp:692: pointless test ?

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

Martin Liška  changed:

   What|Removed |Added

 Resolution|--- |WONTFIX
 Status|ASSIGNED|RESOLVED

--- Comment #6 from Martin Liška  ---
H.J.
We'd like to deprecate MIC offload in GCC 12.  We will remove all traces of
MIC offload in GCC 13.

  1   2   >