[Bug target/42599] arm-elf-gcc 4.4.2 internal compiler error in expand_expr_addr_1 at expr.c:6835

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

--- Comment #3 from Andrew Pinski  ---
We stopped ICEing in GCC 6 it seems but accept the code now.

[Bug c/67665] ICE when passing two empty files directly to cc1 with -g

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

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |8.0
 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #5 from Andrew Pinski  ---
Fixed for GCC 8 by r8-150.

[Bug middle-end/54896] optimization slowness on large basic blocks

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

--- Comment #12 from Andrew Pinski  ---
Note I think -O3 (and now -O2) is much worse recently due to vector SLP taking
a long time too.

[Bug middle-end/97717] compilation with -O(1/2/3) flag failed while -O0 succeeds

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

Andrew Pinski  changed:

   What|Removed |Added

 Depends on||54896
   Keywords||alias

--- Comment #7 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #6)
> fillLUTDIV is basically one big function (one BB) which does:
> 
> inp[...] = ...;
> 1019 times
> 
> fillLUTNEGEXP does the same thing 33659 times.

Which makes this very similar to PR 54896 for at least "alias stmt walking"
time.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54896
[Bug 54896] optimization slowness on large basic blocks

[Bug middle-end/97717] compilation with -O(1/2/3) flag failed while -O0 succeeds

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

--- Comment #6 from Andrew Pinski  ---
fillLUTDIV is basically one big function (one BB) which does:

inp[...] = ...;
1019 times

fillLUTNEGEXP does the same thing 33659 times.


I assume these are generated functions. It might be better to have static const
array which you do a copy from, either memcpy or somehow ever. This will
improve the compile time speed by a lot and maybe even the runtime speed too.

[Bug middle-end/97717] compilation with -O(1/2/3) flag failed while -O0 succeeds

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

Andrew Pinski  changed:

   What|Removed |Added

  Component|tree-optimization   |middle-end

--- Comment #5 from Andrew Pinski  ---
For -O3 the following is bad too:
 load CSE after reload  :  32.11 ( 34%)   0.00 (  0%)  32.11 ( 33%)
 5808  (  0%)

[Bug tree-optimization/97717] compilation with -O(1/2/3) flag failed while -O0 succeeds

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

Andrew Pinski  changed:

   What|Removed |Added

 Status|WAITING |NEW
   Keywords||compile-time-hog

--- Comment #4 from Andrew Pinski  ---
for me, -O1 takes a long time even:
 callgraph ipa passes   :   2.34 ( 26%)   0.49 ( 30%)   2.84 ( 26%)
  159M ( 37%)


-O2 is much worse:
 alias stmt walking :  23.12 ( 37%)   0.14 (  7%)  23.24 ( 36%)
  323M ( 17%)
 tree DSE   :  11.34 ( 18%)   0.00 (  0%)  11.36 ( 18%)
   15k (  0%)
 tree slp vectorization :  16.01 ( 26%)   0.30 ( 15%)  16.32 ( 25%)
 1117M ( 60%)

This is with --enable-checking=yes but with -fno-checking.


So there is at least a compile time hog here.

[Bug c++/93297] internal compiler error: in set_constraints, at cp/constraint.cc:

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #10 from Andrew Pinski  ---
(In reply to John McFarlane from comment #9)
> And here is an ICE in 10.2: 
> 
>struct a;
>template  class b;
>template  b()->b<>;
>template  using c = b;
>static_assert(c{}

This is a dup of bug 95486  which is fixed in GCC 10.4.

All of the rest of the ICEs are fixed for GCC 11.1.0 (some might be fixed in
GCC 10.4 but I have not tried that yet).

[Bug tree-optimization/41137] inefficient zeroing of an array

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

--- Comment #22 from Andrew Pinski  ---
Note this is even at -O2 for GCC 10 and above.

[Bug libfortran/38654] Fortran I/O speedup

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

Bug 41137 Summary: inefficient zeroing of an array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41137

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

[Bug tree-optimization/41137] inefficient zeroing of an array

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

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   Target Milestone|--- |10.0
  Component|fortran |tree-optimization
 Status|WAITING |RESOLVED

--- Comment #21 from Andrew Pinski  ---
Fixed:
   [local count: 118111600]:
  # ivtmp.19_52 = PHI <0(5), ivtmp.19_49(6)>
  # ivtmp.23_7 = PHI <_66(5), ivtmp.23_29(6)>
  _37 = (real(kind=4) *) ivtmp.23_7;
  __builtin_memset (_37, 0, _46);
  ivtmp.19_49 = ivtmp.19_52 + 1;
  ivtmp.23_29 = ivtmp.23_7 + _13;
  if (ivtmp.19_49 == _76)
goto ; [12.36%]
  else
goto ; [87.64%]

[Bug target/68484] _mm_storel_epi64((__m128i *)x, m); does nothing if "x" is a "volatile" ptr

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

--- Comment #10 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #9)
> Fixed for GCC 7 by r7-5301 (aka PR 70118).

-  *(long long *)__P = ((__v2di)__B)[0];
+  *(__m64_u *)__P = (__m64) ((__v2di)__B)[0];

[Bug target/88918] [meta-bug] x86 intrinsic issues

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

Bug 68484 Summary: _mm_storel_epi64((__m128i *)x, m); does nothing if "x" is a 
"volatile" ptr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68484

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

[Bug target/68484] _mm_storel_epi64((__m128i *)x, m); does nothing if "x" is a "volatile" ptr

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

Andrew Pinski  changed:

   What|Removed |Added

  Component|tree-optimization   |target
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=70118
 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Andrew Pinski  ---
Fixed for GCC 7 by r7-5301 (aka PR 70118).

[Bug tree-optimization/68484] _mm_storel_epi64((__m128i *)x, m); does nothing if "x" is a "volatile" ptr

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

Andrew Pinski  changed:

   What|Removed |Added

  Known to work||12.0, 7.1.0, 7.2.0, 8.1.0
  Component|target  |tree-optimization
  Known to fail||4.7.4, 5.1.0, 6.1.0, 6.4.0
   Severity|critical|normal

[Bug c++/63650] conflicting type attributes specified for ‘virtual..'

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

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||rejects-valid
 Status|WAITING |RESOLVED
  Known to fail||12.0, 5.1.0
 Resolution|--- |INVALID

--- Comment #10 from Andrew Pinski  ---
To summarize here is the full testcase which can be used even to test under
MSVC:
#ifdef __GNUC__
#ifndef CDECL
#define CDECL __attribute__((regparm(0),cdecl))
#endif
#else
#define CDECL __cdecl
#endif

class A 
{
  virtual int CDECL foo( void *nok) = 0;
};

class B : public A
{
  int foo(void *nok); /* implicitly virtual */
};


 CUT ---
Note MSVC also rejects this code as invalid:
(16): error C2695: 'B::foo': overriding virtual function differs from
'A::foo' only by calling convention
(11): note: see declaration of 'A::foo'

so I think GCC is correct, you need the CDECL on the foo when overriding the
virtual function too. why clang and ICC accepts it, I have no idea maybe ask
them.

[Bug tree-optimization/77511] internal compiler error: in get_ptr_info

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

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|1   |0
 Status|WAITING |UNCONFIRMED

[Bug tree-optimization/77511] internal compiler error: in get_ptr_info

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

--- Comment #8 from Andrew Pinski  ---
Created attachment 52058
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52058=edit
preprocessed source

This is the preprocessed source just in case the dropbox ever does not work any
more.

[Bug tree-optimization/77511] internal compiler error: in get_ptr_info

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

--- Comment #7 from Andrew Pinski  ---
I tried this under GCC 7.5.0 as provided by Ubuntu (targetting still linux) and
I don't get an ICE. That does not mean it was fixed, just I could not reproduce
it using that compiler version and targeting linux.

[Bug middle-end/60944] a10 pcduino compiling mono

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

Andrew Pinski  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |INVALID
  Component|libgcc  |middle-end

--- Comment #2 from Andrew Pinski  ---
No feedback in over 5 years so closing as invalid.

[Bug libbacktrace/87653] Calling null pointer in multi-threaded applications

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

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |WORKSFORME
 Status|WAITING |RESOLVED

--- Comment #3 from Andrew Pinski  ---
Closing as works for me. If someone else runs into this again we can open it
and maybe even apply the patch.

[Bug middle-end/88599] ICE in make_decl_rtl, at varasm.c:1337

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

Andrew Pinski  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #3 from Andrew Pinski  ---
Two different people tried to reproduce this with no lucj and there was no
feedback for the exact configure since then and it has been almost 3 years so
closing as works for me.

[Bug tree-optimization/71867] Optimizer generates code dereferencing a null pointer

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

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=69243,
   ||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=59704,
   ||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=73434
 Status|WAITING |RESOLVED
   Target Milestone|--- |7.0

--- Comment #13 from Andrew Pinski  ---
Reporter reports it was fixed in GCC 7, There were many bug fixes between GCC
5.3 and GCC 7 so closing as fixed.

[Bug lto/41565] using -m32 with LTO causes an ICE when the object files were compiled with 64bit

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2017-08-07 00:00:00 |2021-12-25

--- Comment #16 from Andrew Pinski  ---
Still ICEs today on x86_64:
apinski@xeond:~/src$ ~/upstream-gcc/bin/gcc -m64 -c -flto t55.c
apinski@xeond:~/src$ ~/upstream-gcc/bin/gcc -m32 -flto t55.o
lto1: internal compiler error: in operator[], at vec.h:889
0x70f75e vec::operator[](unsigned int)
/home/apinski/src/upstream-gcc-git/gcc/gcc/vec.h:889
0x70f8a4 vec::operator[](unsigned int)
/home/apinski/src/upstream-gcc-git/gcc/gcc/lto-streamer-in.c:1832
0x70f8a4 vec::operator[](unsigned int)
/home/apinski/src/upstream-gcc-git/gcc/gcc/vec.h:1495
0x70f8a4 streamer_tree_cache_get_tree
/home/apinski/src/upstream-gcc-git/gcc/gcc/tree-streamer.h:96
0x70f8a4 stream_read_tree_ref(lto_input_block*, data_in*)
/home/apinski/src/upstream-gcc-git/gcc/gcc/lto-streamer-in.c:1819
0xff6c2d lto_input_ts_decl_minimal_tree_pointers
/home/apinski/src/upstream-gcc-git/gcc/gcc/tree-streamer-in.c:710
0xff6c2d streamer_read_tree_body(lto_input_block*, data_in*, tree_node*)
/home/apinski/src/upstream-gcc-git/gcc/gcc/tree-streamer-in.c:1061
0xc38a79 lto_read_tree_1
/home/apinski/src/upstream-gcc-git/gcc/gcc/lto-streamer-in.c:1700
0xc39437 lto_read_tree
/home/apinski/src/upstream-gcc-git/gcc/gcc/lto-streamer-in.c:1741
0xc39437 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int)
/home/apinski/src/upstream-gcc-git/gcc/gcc/lto-streamer-in.c:1882
0x8ad04e lto_read_decls
/home/apinski/src/upstream-gcc-git/gcc/gcc/lto/lto-common.c:1957
0x8adfef lto_file_finalize
/home/apinski/src/upstream-gcc-git/gcc/gcc/lto/lto-common.c:2269
0x8adfef lto_create_files_from_ids
/home/apinski/src/upstream-gcc-git/gcc/gcc/lto/lto-common.c:2279
0x8adfef lto_file_read
/home/apinski/src/upstream-gcc-git/gcc/gcc/lto/lto-common.c:2334
0x8adfef read_cgraph_and_symbols(unsigned int, char const**)
/home/apinski/src/upstream-gcc-git/gcc/gcc/lto/lto-common.c:2785
0x8961f2 lto_main()
/home/apinski/src/upstream-gcc-git/gcc/gcc/lto/lto.c:625
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
lto-wrapper: fatal error: /home/apinski/upstream-gcc/bin/gcc returned 1 exit
status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

[Bug tree-optimization/88527] ICE: tree check: expected integer_cst, have error_mark in equal, at tree.c:1464; or tree check: expected integer_cst, have identifier_node in equal, at tree.c:1464

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

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
   Target Milestone|--- |10.0
 Resolution|--- |FIXED

--- Comment #2 from Andrew Pinski  ---
Fixed according to the reporter.

[Bug c++/82360] [8 Regression] tree check fail in get_inner_reference, at expr.c:6996

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||uruwi at protonmail dot com

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

[Bug c++/83716] tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference

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

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|WAITING |RESOLVED

--- Comment #4 from Andrew Pinski  ---
Dup of bug 82360.

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

[Bug lto/41526] gimple bytecode streams are not portable between different hosts

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||daniel.f.starke at freenet dot 
de

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

[Bug lto/69394] [5.3] ICE when linking with lto

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

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|WAITING |RESOLVED

--- Comment #6 from Andrew Pinski  ---
Dup of bug 41526. I don't know if we had any progress on making the byte-code
host independent yet though.

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

[Bug lto/52405] undefined references in shared library when linking the shared library with -flto

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

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||link-failure
 Status|WAITING |RESOLVED
 Resolution|--- |INVALID

--- Comment #4 from Andrew Pinski  ---
The file http://people.debian.org/~doko/tmp/hs.tar.xz no longer exists and
there was no movement in reducing the LTO failure and many things has
changed/improvement since GCC 4.7 with respect to LTO so closing as invalid. If
you get a new testcase please attach it and/or give instructions how to build
the project without a temporary storage location.

[Bug middle-end/47334] g++.dg/torture/pr31863.C -O2 -flto FAILs without visibility

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

--- Comment #5 from Andrew Pinski  ---
Can someone test the patch in
https://gcc.gnu.org/bugzilla/attachment.cgi?id=52057 ?

[Bug testsuite/103823] g++.dg/torture/pr31863.C fails on darwin with "using serial compilation of 2 LTRANS jobs"

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

--- Comment #6 from Andrew Pinski  ---
Created attachment 52057
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52057=edit
Patch to test

Can you try this patch?

[Bug testsuite/103823] g++.dg/torture/pr31863.C fails on darwin with "using serial compilation of 2 LTRANS jobs"

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

--- Comment #5 from Andrew Pinski  ---
(In reply to Francois-Xavier Coudert from comment #3)
> Any reason not to move the test to the lto testsuite?

Most likely should have been when PR 47334 was filed but since the failure only
showed up on solaris and using sun's as, nobody really cared to move it :).

[Bug driver/69711] Wrong suggestion for -ftree-ivopts

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
g++: error: unrecognized command-line option '-ftree-ivopts'; did you mean
'-fno-ivopts'?

Fixed by r6-6899.

[Bug tree-optimization/55157] Missed VRP with != 0 and multiply

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2021-06-08 00:00:00 |2021-12-25

--- Comment #3 from Andrew Pinski  ---
LLVM is able to remove the check.

[Bug tree-optimization/18940] Loop is not vectorized when it should be (VRP)

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

Andrew Pinski  changed:

   What|Removed |Added

 Blocks|53947   |26731

--- Comment #6 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #5)
> Notice how we have the range for D1360_10 but then don't optimize the
> COND_EXPR 

Which is the same problem as I mentioned in PR 26731.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26731
[Bug 26731] Jump threading gets in the way of loops
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

[Bug tree-optimization/18940] Loop is not vectorized when it should be (VRP)

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

Andrew Pinski  changed:

   What|Removed |Added

 Status|SUSPENDED   |NEW

--- Comment #5 from Andrew Pinski  ---
This is mostly fixed on the trunk.
What is left is:
  # RANGE [1, 1073741823] NONZERO 1073741823
  D1360_10 = n_9(D) >> 1;
...
  # RANGE [4, 4294967292] NONZERO 4294967295
  _18 = D1360_10 > 0 ? _19 : 4;

Notice how we have the range for D1360_10 but then don't optimize the COND_EXPR


[Bug target/52572] suboptimal assignment to avx element

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

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Last reconfirmed||2021-12-25
 Target||x86_64-linux-gnu
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

--- Comment #4 from Andrew Pinski  ---
LLVM produces:

vxorps  %xmm1, %xmm1, %xmm1
vblendps$3, %ymm1, %ymm0, %ymm0 # ymm0 =
ymm1[0,1],ymm0[2,3,4,5,6,7]

and

vxorps  %xmm0, %xmm0, %xmm0
vblendps$252, (%rdi), %ymm0, %ymm0  # ymm0 =
ymm0[0,1],mem[2,3,4,5,6,7]

Which I suspect is better.

[Bug ipa/24169] Address (full struct) escapes even though the called function does not cause it to escape

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org
 Resolution|--- |FIXED
 Status|NEW |RESOLVED
  Component|tree-optimization   |ipa
   Target Milestone|--- |12.0

--- Comment #5 from Andrew Pinski  ---
Fixed on the trunk by the IPA modref improvements.

[Bug rtl-optimization/103829] [9/10/11/12 Regression] missing shrink wrapping for simple/obvious code

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

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||9.1.0
  Known to work||8.5.0
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=87902
   Target Milestone|--- |9.5

--- Comment #1 from Andrew Pinski  ---
Might be similar to PR 87902

[Bug rtl-optimization/103829] New: [9/10/11/12 Regression] missing shrink wrapping for simple/obvious code

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

Bug ID: 103829
   Summary: [9/10/11/12 Regression] missing shrink wrapping for
simple/obvious code
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
Target: x86_64-linux-gnu aarch64-linux-gnu

Take:

extern int _IO_getc (void *) ;
extern int *__errno_location (void) __attribute__ ((__const__));
void readError ( void );
typedef
   struct {
  void* handle;
  int buffer;
  int buffLive;
  char mode;
   }
   BitStream;

int bsGetBit ( BitStream* bs )
{  
   if (bs->buffLive > 0) {
  bs->buffLive --;
  return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 );
   } else {
  int retVal = _IO_getc (bs->handle);
  if ( retVal == (-1) ) {
 if ((*__errno_location ()) != 0) readError();
 return 2;
  }
  bs->buffLive = 7;
  bs->buffer = retVal;
  return ( ((bs->buffer) >> 7) & 0x1 );
   }
}
- CUT 
GCC 4.9.0-8.5.0 was able to shrink wrap the above function.
But starting in GCC 9, GCC does not; there is an extra mov using a callee saved
register.
This happens on both aarch64 and x86_64 So I suspect it was a generic change
which caused it.

[Bug c++/103653] GCC rejected int x = 0; auto(x); in C++23

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

--- Comment #3 from Andrew Pinski  ---
>But I think auto(x) should also be well-formed.

it is well formed as a declaration.
  auto(x) = 1;

Unless something changed in that part of C++ standard too.


The following does work as expected too:
int main() {
  int x = 0;
  float t;
  t = auto(x);
}

[Bug middle-end/89543] Don't modify TREE_NO_WARNING during folding in place

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

Andrew Pinski  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW

--- Comment #6 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #5)
> (In reply to Andrew Pinski from comment #4)
> > [apinski@xeond2 upstream-gcc-git]$ gdb --args ./gcc/objdir/stage1-gcc/cc1
> > /home/apinski/src/upstream-gcc-git/gcc/gcc/testsuite/gcc.dg/Wstringop-
> > overread-6.c
> > 
> > 
> > (gdb) p debug_generic_expr(expr)
> > strlen ((const char *)  + 4)
> 
> Here is the reduced testcase:
> const char arr[7] = "abc\0def";
> int warn_strlen (void)
> {
>   return __builtin_strlen (arr+4);
> }

fold_builtin_strlen->warn_string_no_nul->suppress_warning->set_no_warning_bit
(expr, supp);

Which then sets the bit.

No longer working on this. But at least I recorded where one of the
TREE_NO_WARNING flag is set these days.

[Bug fortran/103828] Type generated for CHARACTER(C_CHAR), VALUE arguments is wrong

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

--- Comment #1 from Francois-Xavier Coudert  ---
The condition for being treated as a special CHARACTER case in gfc_sym_type()
is:

  if (sym->ts.type == BT_CHARACTER
  && ((sym->attr.function && sym->attr.is_bind_c)
  || (sym->attr.result
  && sym->ns->proc_name
  && sym->ns->proc_name->attr.is_bind_c)
  || (sym->ts.deferred && (!sym->ts.u.cl
   || !sym->ts.u.cl->backend_decl

Here we're not a function, not a result variable, we don't have
sym->ts.deferred.

I am thinking we may want to do this:

--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2262,14 +2262,14 @@ gfc_sym_type (gfc_symbol * sym, bool is_bind_c)

   if (sym->ts.type == BT_CHARACTER
   && ((sym->attr.function && sym->attr.is_bind_c)
- || (sym->attr.result
+ || ((sym->attr.result || sym->attr.value)
  && sym->ns->proc_name
  && sym->ns->proc_name->attr.is_bind_c)
  || (sym->ts.deferred && (!sym->ts.u.cl
   || !sym->ts.u.cl->backend_decl

But while it does give the propre tree-type, it does not fix the global issue.

[Bug middle-end/89543] Don't modify TREE_NO_WARNING during folding in place

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

--- Comment #5 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #4)
> [apinski@xeond2 upstream-gcc-git]$ gdb --args ./gcc/objdir/stage1-gcc/cc1
> /home/apinski/src/upstream-gcc-git/gcc/gcc/testsuite/gcc.dg/Wstringop-
> overread-6.c
> 
> 
> (gdb) p debug_generic_expr(expr)
> strlen ((const char *)  + 4)

Here is the reduced testcase:
const char arr[7] = "abc\0def";
int warn_strlen (void)
{
  return __builtin_strlen (arr+4);
}

[Bug target/31263] addressing modes are not selected correcly for x86 always

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2021-12-25
   Severity|minor   |enhancement
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #5 from Andrew Pinski  ---
  _1 = i_10 + 500;
  _2 = _1 * 2;
  _3 = _2 - i_10;
  _4 = _3 - i_10;

(simplify
 (minus (mult:s (plus:cs @0 @1) INTEGER_CST@2) @0)
  (plus (mult @0 (minus @2 { build_one_cst (type); }) (mult @1 @2

Will work for the above case though I don't know if it is the right thing to do
as we are trading one mult for 2 in some cases.

[Bug middle-end/89543] Don't modify TREE_NO_WARNING during folding in place

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

--- Comment #4 from Andrew Pinski  ---
[apinski@xeond2 upstream-gcc-git]$ gdb --args ./gcc/objdir/stage1-gcc/cc1
/home/apinski/src/upstream-gcc-git/gcc/gcc/testsuite/gcc.dg/Wstringop-overread-6.c


(gdb) p debug_generic_expr(expr)
strlen ((const char *)  + 4)

[Bug fortran/103828] Type generated for CHARACTER(C_CHAR), VALUE arguments is wrong

2021-12-25 Thread iains at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103828

Iain Sandoe  changed:

   What|Removed |Added

   Keywords||wrong-code
   Last reconfirmed||2021-12-25
 CC||iains at gcc dot gnu.org
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

[Bug fortran/103828] New: Type generated for CHARACTER(C_CHAR), VALUE arguments is wrong

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

Bug ID: 103828
   Summary: Type generated for CHARACTER(C_CHAR), VALUE arguments
is wrong
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fxcoudert at gcc dot gnu.org
  Target Milestone: ---

On the aarch64-apple-darwin port (Apple Silicon), currently in late-stage
development, the runtime test gfortran.dg/c_kind_params.f90 fails. After
reducing it (https://github.com/iains/gcc-darwin-arm64/issues/73) we have
determined that the front-end is emitting wrong trees. Take this function:

subroutine param_test (a, b, c, d, e, f, g, h, v, w) bind(c)
  use, intrinsic :: iso_c_binding
  implicit none
  integer(c_int), value :: a, b, c, d, e, f, g, h
  character(c_char), value :: v
  integer(c_signed_char), value :: w
  if (w /= 1) call foo
end subroutine

where argument V is a scalar, pass-by-value, C char (an unsigned char, although
it does not matter for interoperability, because that's how the Fortran
front-end does things). The equivalent C function is therefore:

void param_test(int a, int b, int c, int d, int e, int f, int g, int h,
unsigned char v, signed char w)
{
  if (w != 1)
foo_();
}

But gcc can emit different arguments for the Fortran and C versions. The reason
is because of the tree type for the V argument, which is invalid as emitted by
the Fortran front-end.

Inserting a call to debug_tree() in gfc_get_function_type() shows that the type
for the V argument is:

 
unit-size 
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x105844348 precision:8 min  max 
pointer_to_this >
string-flag QI size  unit-size 
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x1059e9260
domain 
unit-size 
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x105844738 precision:64 min  max

pointer_to_this >
DI size  unit-size 
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x1059e9110 precision:64 min  max >>


See how this is actually not a scalar character(kind=1), but as an array type.
On aarch64-apple-darwin, this leads to a different passing of the argument, and
therefore to the testcase failure.

Where is this type tree generated? It comes from gfc_sym_type(), where the is a
special treatment for BT_CHARACTER. Weirdly, we don't follow that (not sure why
the conditions don't cover this case). We go instead into
gfc_typenode_for_spec(), which calls gfc_get_character_type(), which returns an
array, which is wrong.

[Bug d/103728] Allow to run unittests before main()

2021-12-25 Thread ibuclaw at gdcproject dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103728

--- Comment #3 from Iain Buclaw  ---
(In reply to Pierrick Bouvier from comment #2)
> Problem with command line approach is that it implies to patch all our
> scripts, which is *really* boring. At this point, manually adding rt_options
> string in all binaries is easier.
> 
> Alas, there is no environment variable for controlling this.
Environment variables can be used if you declare:
```
extern(C) __gshared bool rt_envvars_enabled = true;
```
Then DRT_testmode=run-main should work.

[Bug middle-end/89543] Don't modify TREE_NO_WARNING during folding in place

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

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|12.0|---

--- Comment #3 from Andrew Pinski  ---
FAIL: c-c++-common/Warray-bounds-7.c  -Wc++-compat  (internal compiler error:
fold check: original tree changed by fold)


Looks like there are a few left.

[Bug c++/103653] GCC rejected int x = 0; auto(x); in C++23

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

康桓瑋  changed:

   What|Removed |Added

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

--- Comment #2 from 康桓瑋  ---
(In reply to 康桓瑋 from comment #1)
> Oh, should be +auto(x);

But I think auto(x) should also be well-formed.

[Bug other/63426] [meta-bug] Issues found with -fsanitize=undefined

2021-12-25 Thread fxcoudert at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63426
Bug 63426 depends on bug 99191, which changed state.

Bug 99191 Summary: sanitizer detects undefined behaviour in libgfortran
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99191

   What|Removed |Added

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

[Bug libfortran/99191] sanitizer detects undefined behaviour in libgfortran

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

Francois-Xavier Coudert  changed:

   What|Removed |Added

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

--- Comment #3 from Francois-Xavier Coudert  ---
Fixed.

[Bug libfortran/81986] sanitizer detects negation of large number in string.c

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

Francois-Xavier Coudert  changed:

   What|Removed |Added

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

--- Comment #9 from Francois-Xavier Coudert  ---
Fixed.

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

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

--- Comment #11 from H.J. Lu  ---
The v3 patch is posted at

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

[Bug libfortran/81986] sanitizer detects negation of large number in string.c

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

Francois-Xavier Coudert  changed:

   What|Removed |Added

 CC||fxcoudert at gcc dot gnu.org

--- Comment #8 from Francois-Xavier Coudert  ---
Will be fixed by patch at
https://gcc.gnu.org/pipermail/fortran/2021-December/057218.html

[Bug libfortran/99191] sanitizer detects undefined behaviour in libgfortran

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

Francois-Xavier Coudert  changed:

   What|Removed |Added

 CC||fxcoudert at gcc dot gnu.org

--- Comment #2 from Francois-Xavier Coudert  ---
Will be fixed by patch at
https://gcc.gnu.org/pipermail/fortran/2021-December/057218.html

[Bug libfortran/98076] Increase speed of integer I/O

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

--- Comment #8 from Francois-Xavier Coudert  ---
Patch posted at https://gcc.gnu.org/pipermail/fortran/2021-December/057219.html

[Bug c++/70723] Missed optimization opportunity for lambda converted to fun-ptr

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

--- Comment #4 from Andrew Pinski  ---
With -std=c++17 (which is the default now), the code is optimized as expected.
With -std=c++14, the dynamic initializer comes into play; there are a few other
bugs dealing with that already too.

[Bug c++/84411] Missed optimization: static guard variable generated for empty virtual destructor

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

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug libstdc++/87502] Poor code generation for std::string("c-style string")

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

--- Comment #8 from Andrew Pinski  ---
(In reply to Marc Glisse from comment #3)
> (In reply to M Welinder from comment #2)
> > The destruction still stinks: the full destructor is inlined instead of
> > the small-string-only version (i.e., a no-op).  Evidently gcc cannot
> > see that the string remains a small-string.
> 
> void foo (const std::string ){
>   const_cast(s)="some longer string so it needs proper
> deletion";
> }

I submitted PR 103827 for the similar case but only passed via a hidden
reference instead.

[Bug c++/103827] New: function which takes an argument via (hidden) reference should assume the argument does not escape or is only read from

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

Bug ID: 103827
   Summary: function which takes an argument via (hidden)
reference should assume the argument does not escape
or is only read from
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: alias, missed-optimization
  Severity: enhancement
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
#include 

extern void foo (const std::string );

void
bar ()
{
  foo ("abc");
  foo (std::string("abc"));
}

 CUT 
Right now we get:
  MEM[(struct _Alloc_hider *)]._M_p = _M_local_buf;
  __builtin_memcpy (_M_local_buf, "abc", 3);
  D.33220._M_string_length = 3;
  MEM[(char_type &) + 19] = 0;
  foo ();

   [local count: 1073741824]:
  _5 = D.33220._M_dataplus._M_p;
  if (_M_local_buf != _5)

But the address of what was passed to foo cannot escape and foo cannot change
the content of D.33220. So the read of D.33220._M_dataplus._M_p should always
return _M_local_buf.

[Bug tree-optimization/87355] missed comparison optimizations (grep DFA, x86-64)

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||pinskia at gcc dot gnu.org
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2021-12-25

--- Comment #4 from Andrew Pinski  ---
Confirmed.
for f, if GCC would swap around the conditional, we would get decent code.

That is like this:

int f1 (int n, int i)
{
  if (n == THRESHOLD)
return i;
  if (n >= THRESHOLD)
return 0;
  return -1;
}

If we have:
   [local count: 1073741823]:
  if (n_3(D) > 99)
goto ; [96.19%]
  else
goto ; [3.81%]

   [local count: 1032832263]:
  if (n_3(D) == 100)
goto ; [34.00%]
  else
goto ; [66.00%]

   [local count: 681669290]:

   [local count: 1073741824]:
  # _1 = PHI <0(4), -1(2), i_4(D)(3)>

We should notice that the conditional at bb 3 is independent and that swapping
would get us a PHI which has 0, -1 which can then be phiopt'ed.

[Bug target/86131] powerpc: gcc uses costly multiply instead of shift left

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

--- Comment #2 from Andrew Pinski  ---
The cost has been 2 since the day -mcpu=860 was added back in 1996 (r0-10828).

[Bug target/86693] inefficient atomic_fetch_xor

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

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug rtl-optimization/51982] Shrink-wrapping opportunity

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2012-01-24 00:00:00 |2021-12-25
  Component|middle-end  |rtl-optimization

--- Comment #6 from Andrew Pinski  ---
Note in the self-contained example, you need to remove the static from
lookdict_unicode function.

But I still see there is no shrink-wrapping happening on aarch64, even though
it could with some minor register allocation changes.

[Bug c++/103826] Bogus shift-negative-value warning in C++20 mode

2021-12-25 Thread manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103826

--- Comment #2 from Jörn Heusipp  ---
(In reply to Andrew Pinski from comment #1)

> Note I notice clang warns about:
> int main() {
> return (0x7000') << 4;
> }

It's valid, but clang complains here about shifting bits out of the range of
the target type:
warning: signed shift result (0x7) requires 36 bits to represent, but
'int' only has 32 bits [-Wshift-overflow]

It does not warn when only shifting into the sign bit (and not overflowing the
bits of the target type):
return (0x7000') << 1;

I am not sure what the intended semantics of -Wshift-overflow is for clang, but
I have reported .

[Bug tree-optimization/36011] Loop interchange not performed, data dependence analysis defect

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2008-12-28 06:32:01 |2021-12-25

--- Comment #2 from Andrew Pinski  ---
This is still true, you need still need  -fno-tree-pre -fno-tree-loop-im to get
the loop to interchanged.

-O2 -fno-tree-pre -fno-tree-loop-im -floop-interchange works while just -O2
-floop-interchange does not.

[Bug tree-optimization/36010] Loop interchange not performed

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

--- Comment #4 from Andrew Pinski  ---
This is still true, you need still need  -fno-tree-pre -fno-tree-loop-im to get
the loop to interchanged.

-O2 -fno-tree-pre -fno-tree-loop-im -floop-interchange works while just -O2
-floop-interchange does not.

[Bug c++/24928] static const objects should go to .rodata

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

--- Comment #5 from Andrew Pinski  ---
With -fimplicit-constexpr, GCC do the optimization, maybe this will become part
of the C++ standard in the future 

[Bug c++/103826] Bogus shift-negative-value warning in C++20 mode

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
Confirmed, when the paper was implemented (r9-4132), this warning was missed it
seems.

Note I notice clang warns about:
int main() {
return (0x7000') << 4;
}

Which is valid now too, GCC disabled the warning for C++20 with r9-4132.

[Bug c++/103826] New: Bogus shift-negative-value warning in C++20 mode

2021-12-25 Thread manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103826

Bug ID: 103826
   Summary: Bogus shift-negative-value warning in C++20 mode
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: manx-bugzilla at problemloesungsmaschine dot de
  Target Milestone: ---

C++20 changed the semantics when shifting negative values from undefined
behavior to defined semantics. However, GCC still warns with -std=c++20 in this
case, which is unfortunate, because it generates a lot of warnings when porting
code to modern C++20. The warning is enabled by -Wextra.

```
int foo() {
return (-32767) << 3;
}
```
`-std=c++20 -Wall -Wextra -Wpedantic`:
```
: In function 'int foo()':
:2:21: warning: left shift of negative value [-Wshift-negative-value]
2 | return (-32767) << 3;
  |~^~~~
```

Clang also warns in this case in C++17 mode, but does not warn in C++20 mode.
See .

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

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org

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

[Bug tree-optimization/77893] VRP simplify_bit_ops_using_ranges should be applied during propagation

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
Dup of bug 103221.  Even though this bug is older, PR 103221 has a testcase
though for |, a similar one for & could likely be made.

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

[Bug ipa/56139] [9/10/11/12 Regression] unmodified static data could go in .rodata, not .data

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

Andrew Pinski  changed:

   What|Removed |Added

  Component|tree-optimization   |ipa
   Target Milestone|--- |13.0
   Keywords||deferred
  Known to fail||4.7.1
   Severity|enhancement |normal
 CC||marxin at gcc dot gnu.org
Summary|unmodified static data  |[9/10/11/12 Regression]
   |could go in .rodata, not|unmodified static data
   |.data   |could go in .rodata, not
   ||.data

--- Comment #2 from Andrew Pinski  ---
We do handle:
static int x[] = {1, 2, 3, 4};

void bar (int x);

int func(int i)
{
bar(x[i]);

return 0;
}

Just fine. It is the IR of the other case where we mess up. And it looks like
it is a regression too. I suspect it is because we used to be able to create
back the ARARY_REF in GCC 4.6.x and that was removed in GCC 4.7 as it caused
other issues.

[Bug ipa/63533] Function splitter causes unnecessary splits

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #5 from Andrew Pinski  ---
> The attached reprocase contains an innocent function which can not ever 
> benefit from inlining.

That is not true any more.
In GCC 10+, we get:
g:
testl   %edi, %edi
jne .L8
subq$1016, %rsp
xorl%eax, %eax
movq%rsp, %rdi
callf
addq$1016, %rsp
ret
.p2align 4,,10
.p2align 3
.L8:
jmp g.part.0

g.part.0:
subq$8, %rsp
xorl%eax, %eax
callf
xorl%eax, %eax
callf
xorl%eax, %eax
callf
xorl%eax, %eax
callf
xorl%eax, %eax
addq$8, %rsp
jmp f

So we conserve stack space now due to two things, conditional shrink wrapping
and being able to tail callto g.part.0. The performance miss is just one
unconditional jump (there is another bug handling conditional tail calls
already).

So all fixed in GCC 10+.

[Bug tree-optimization/55846] Cannot sink conditional code

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2016-08-14 00:00:00 |2021-12-25

--- Comment #2 from Andrew Pinski  ---
The following two functions should produce the same assembly code in this case:
[[gnu::const]]
static inline int g(int b, int c) {return b * 2 + 4;}
int foo (int b, int c)
{
  int res = 0;
  if (b)
res = g(b, c);
  if (c)
return res;
  return 0;
}
int foo1 (int b, int c)
{
  int res = 0;
  if (c)
   { if (b) res = g(b, c); else res = 0; return res;}
  return 0;
}

[Bug middle-end/66872] fold a & ((1 << b) - 1) to a & ~(-1 << b)

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2015-07-15 00:00:00 |2021-12-25

--- Comment #5 from Andrew Pinski  ---
AARCH64 it is more obvious:
mov w2, 1
lsl w2, w2, w1
sub w2, w2, #1
and w0, w2, w0

vs
mov w2, -1
lsl w2, w2, w1
bic w0, w0, w2

[Bug tree-optimization/70527] Missed fold for "(long int) x * 12 - (long int)(x + 1) * 12"

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

Andrew Pinski  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
  Known to work||8.1.0
  Known to fail||7.5.0
 Resolution|--- |FIXED
   Target Milestone|--- |8.0

--- Comment #3 from Andrew Pinski  ---
Fixed in GCC 8 by r8-6371.

[Bug tree-optimization/56355] abs and multiplication

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2016-07-24 00:00:00 |2021-12-25

--- Comment #6 from Andrew Pinski  ---
The only one which I think is missing is:
(if (FLOAT_TYPE_P (type))
 (simplify
  (mult (abs @0) (abs @1))
  (abs (mult @0 @1)))

But I do think we can only do it for FLOAT_TYPE_P as
((unsigned)INT_MIN)*((unsigned)-1) will be different when using abs I think.

[Bug target/66664] gcc misses optimization emits subtraction where relocation arithmetic would suffice

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

Andrew Pinski  changed:

   What|Removed |Added

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

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

[Bug tree-optimization/70868] Assigning constructed temporary of class with nontrivial constructor uses unnecessary temporary

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
Fixed in GCC 7 by r7-5443.

[Bug middle-end/67418] resolution to constant fails between pointer on stack and pointer within argument structure

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

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |7.0
 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #3 from Andrew Pinski  ---
Fixed in GCC 7, most likely by r7-391.