[Bug tree-optimization/109695] [14 Regression] crash in gimple_ranger::range_of_expr since r14-377-gc92b8be9b52b7e

2023-05-10 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109695

--- Comment #35 from Aldy Hernandez  ---
We could also tweak the number of sub-ranges.  8 (??) also sounds good for a
few percent less in performance drop, if we care.

p.s. I did try the auto_vec thing for a 25% loss in VRP performance, even when
using address(), reserve(), etc.  I may have gotten something wrong, but it
didn't look promising.  I could post my attempt and someone could take it from
there, but I think the one irange approach with sensible defaults that
automatically grow to MAX, better.

[Bug tree-optimization/109695] [14 Regression] crash in gimple_ranger::range_of_expr since r14-377-gc92b8be9b52b7e

2023-05-10 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109695

--- Comment #34 from Aldy Hernandez  ---
Excellent ideas!

For that matter, we may get away with defaulting to 3 sub-ranges and always
resizing as needed (up to MAX).  Needing more than 3 sub-ranges is so rare
(less than 0.5% of the time), that the penalty will be small.

Furthermore, these defaults are sensible enough that we could nuke int_range
altogether and have irange have this small [3*2] array.  After all, most uses
of int_range now are int_range_max, since we never know the size of the
range (except in rare cases such as boolean_type_node, etc).  This would
simplify the code and get rid of the annoying templates which I hate.  No need
for int_range_max, or int_range, etc.  Just plain irange.

This would give us an irange of 592 bytes compared to 40912 for int_range_max
currently.  Plus, it's not that far away from int_range<2> which currently is
432 bytes, and as I mentioned, barely happens as we mostly use int_range_max.

I think this is a nice trade off.  Cleaner more flexible code, without
templates.

Oh... preliminary tests show it's a 5% penalty for VRP, which is more than
covered by our 13.22% improvement (plus Andrew's cache improvements) to VRP.

[Bug debug/109805] LTO affecting -fdebug-prefix-map

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109805

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
Let's reopen this one for a few.

[Bug debug/109805] LTO affecting -fdebug-prefix-map

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109805

Andrew Pinski  changed:

   What|Removed |Added

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

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

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

[Bug debug/87726] -fdebug-prefix-map doesn't work with lto

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87726

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

[Bug tree-optimization/109806] 13.1.0 cc1plus stack smashing crash with C array of complex structs

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109806

--- Comment #1 from Andrew Pinski  ---
>it's 1.6MB, so it was impossible to attach them here uncompressed

Can you try to compress it and attach it?

[Bug c++/109806] New: 13.1.0 cc1plus stack smashing crash with C array of complex structs

2023-05-10 Thread amy at amyspark dot me via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109806

Bug ID: 109806
   Summary: 13.1.0 cc1plus stack smashing crash with C array of
complex structs
   Product: gcc
   Version: 13.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: amy at amyspark dot me
  Target Milestone: ---

Hi,

Coming from
https://github.com/msys2/MINGW-packages/pull/16968#issuecomment-1541465457.
I've found a crash in cc1plus 13.1.0 when building an array of ~68 structs in
C++. The crash yields no report or crash handling, it just causes g++  to
return exit code 1.

However, I was able to trap the cc1plus execution line, and then run it
manually under GDB. This yielded a symbolicated stacktrace that I've uploaded
along with the preprocessed file (it's 1.6MB, so it was impossible to attach
them here uncompressed):

https://gist.github.com/amyspark/be93638fc5b5779594dd138aa8995860

GCC version data:

Using built-in specs.
COLLECT_GCC=D:\msys64\ucrt64\bin\gcc.exe
COLLECT_LTO_WRAPPER=D:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-13.1.0/configure --prefix=/ucrt64
--with-local-prefix=/ucrt64/local --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
--with-native-system-header-dir=/ucrt64/include --libexecdir=/ucrt64/lib
--enable-bootstrap --enable-checking=release --with-arch=nocona
--with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit
--enable-shared --enable-static --enable-libatomic --enable-threads=posix
--enable-graphite --enable-fully-dynamic-string
--enable-libstdcxx-filesystem-ts --enable-libstdcxx-time
--disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-libssp
--disable-multilib --disable-rpath --disable-win32-registry --disable-nls
--disable-werror --disable-symvers --with-libiconv --with-system-zlib
--with-gmp=/ucrt64 --with-mpfr=/ucrt64 --with-mpc=/ucrt64 --with-isl=/ucrt64
--with-pkgversion=Rev4, Built by MSYS2 project
--with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as
--with-gnu-ld --enable-libstdcxx-debug --with-boot-ldflags="-static-libstdc++"
--with-stage1-ldflags="-static-libstdc++"
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.0 (Rev4, Built by MSYS2 project) 

Prior to https://github.com/msys2/MINGW-packages/pull/17094, the CFLAGS value
was (I added debug !strip to the PKGBUILD options to get debugging symbols):

-g -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2
-fstack-protector-strong -ggdb -Og
-ffile-prefix-map=/c/Users/Amalia/Desktop/MINGW-packages/mingw-w64-gcc/src=/usr/src/debug/mingw-w64-gcc

[Bug debug/109805] LTO affecting -fdebug-prefix-map

2023-05-10 Thread sergiodj at sergiodj dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109805

--- Comment #1 from Sergio Durigan Junior  ---
The formatting for the example snippet got messed up.  Here's a fixed version:

$ echo 'int main(){}' > foo.c
$ ~/gcc/install/bin/gcc -c foo.c -O2 -g -flto=auto -ffat-lto-objects
-fdebug-prefix-map=`pwd`=/aaa -o foo
$ ~/gcc/install/bin/gcc foo -flto=auto -ffat-lto-objects -o bar

[Bug debug/109805] New: LTO affecting -fdebug-prefix-map

2023-05-10 Thread sergiodj at sergiodj dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109805

Bug ID: 109805
   Summary: LTO affecting -fdebug-prefix-map
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: sergiodj at sergiodj dot net
  Target Milestone: ---

Hi,

In Ubuntu we use -fdebug-prefix-map to remap a package's build directory (which
contains random stuff) into a predictable path under /usr/src.  This is done in
order to help debuginfod index the source code for our packages.

Things work very well, but I found a weird corner case involving LTO.  The
affected package is vim.  You can see the build logs for it here:

https://launchpadlibrarian.net/665520301/buildlog_ubuntu-mantic-amd64.vim_2%3A9.0.1378-2ubuntu1_BUILDING.txt.gz

As you can notice, we're using -fdebug-prefix-map and LTO for the build.

The problem is that the resulting debuginfo doesn't have the remaped directory.
 I can replicate the issue locally, and at first I thought this was either bug
#108464 or #87726, but after some digging I'm convinced it's something else. 
I've compiled gcc (GCC) 14.0.0 20230510 from the master branch
(608e7f3ab47fe746279c552c3574147aa3d8ee76), and I still can reproduce the
problem.

A simple reproducer for the problem follows:

$ echo 'int main(){}' > foo.c $ ~/gcc/install/bin/gcc -c foo.c -O2 -g
-flto=auto -ffat-lto-objects -fdebug-prefix-map=`pwd`=/aaa -o foo $
~/gcc/install/bin/gcc foo -flto=auto -ffat-lto-objects -o bar

A workaround for this bug is to either stop using LTO or explicitly set
-fdebug-prefix-map when linking the object.

[Bug debug/87726] -fdebug-prefix-map doesn't work with lto

2023-05-10 Thread sergiodj at sergiodj dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87726

Sergio Durigan Junior  changed:

   What|Removed |Added

 CC||sergiodj at sergiodj dot net

--- Comment #3 from Sergio Durigan Junior  ---
FWIW, this is working for me (GCC 12).  I'm investigating another bug with
-fdebug-prefix-map and LTO, and thought this one would be related.

[Bug libstdc++/109772] [13/14 Regression] Memory layout optimization of std::chrono::hh_mm_ss is wrong

2023-05-10 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109772

--- Comment #4 from Jonathan Wakely  ---
There's another problem which is that hh_mm_ss>>
fails to compile:

/home/jwakely/gcc/13/include/c++/13.0.1/chrono: In instantiation of 'class
std::chrono::hh_mm_ss > >':
hms.cc:12:63:   required from here
/home/jwakely/gcc/13/include/c++/13.0.1/chrono:2439:37: error: ambiguous
template instantiation for 'struct
std::chrono::hh_mm_ss >
>::__subseconds > >'
 2439 | __subseconds _M_ss{};
  | ^
/home/jwakely/gcc/13/include/c++/13.0.1/chrono:2412:18: note: candidates are:
'template template  requires
!(treat_as_floating_point_v<_Rep>) && (ratio_less_v<_Period, std::ratio<1, 1>
>) && ((ratio_greater_equal_v<_Period, std::ratio<1, 250> >) ||
(__fits)) struct
std::chrono::hh_mm_ss<_Duration>::__subseconds > [with _Rep = long int; _Period = std::ratio<1, 100>; _Duration =
std::chrono::duration >]'
 2412 |   struct __subseconds>
  |  ^
/home/jwakely/gcc/13/include/c++/13.0.1/chrono:2426:18: note:
'template template  requires
!(treat_as_floating_point_v<_Rep>) && (ratio_less_v<_Period, std::ratio<1, 250>
>) && ((ratio_greater_equal_v<_Period, std::ratio<1, 40> >) ||
(__fits)) struct
std::chrono::__subseconds > [with _Rep =
long int; _Period = std::ratio<1, 100>; _Duration =
std::chrono::duration >]'
 2426 |   struct __subseconds>
  |  ^

[Bug c++/109680] [13 Regression] is_convertible incorrectly true

2023-05-10 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109680

Marek Polacek  changed:

   What|Removed |Added

Summary|[13/14 Regression]  |[13 Regression]
   |is_convertible incorrectly true  |int(*)()> incorrectly true

--- Comment #10 from Marek Polacek  ---
Fixed on trunk so far.

[Bug c++/109680] [13/14 Regression] is_convertible incorrectly true

2023-05-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109680

--- Comment #9 from CVS Commits  ---
The trunk branch has been updated by Marek Polacek :

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

commit r14-669-g4c2ffb02fd4104d77c5d907662f04434dc4c3fe8
Author: Marek Polacek 
Date:   Tue May 2 17:36:00 2023 -0400

c++: wrong std::is_convertible with cv-qual fn [PR109680]

This PR points out that std::is_convertible has given the wrong answer
in

  static_assert (!std::is_convertible_v , "");

since r13-2822 implemented __is_{,nothrow_}convertible.

std::is_convertible uses the imaginary

  To test() { return std::declval(); }

to do its job.  Here, From is 'int () const'.  std::declval is defined as:

  template
  typename std::add_rvalue_reference::type declval() noexcept;

std::add_rvalue_reference is defined as "If T is a function type that
has no cv- or ref- qualifier or an object type, provides a member typedef
type which is T&&, otherwise type is T."

In our case, T is cv-qualified, so the result is T, so we end up with

  int () const declval() noexcept;

which is invalid.  In other words, this is pretty much like:

  using T = int () const;
  T fn1(); // bad, fn returning a fn
  T& fn2(); // bad, cannot declare reference to qualified function type
  T* fn3(); // bad, cannot declare pointer to qualified function type

  using U = int ();
  U fn4(); // bad, fn returning a fn
  U& fn5(); // OK
  U* fn6(); // OK

I think is_convertible_helper needs to simulate std::declval better.
To that end, I'm introducing build_trait_object, to be used where
a declval is needed.

PR c++/109680

gcc/cp/ChangeLog:

* method.cc (build_trait_object): New.
(assignable_expr): Use it.
(ref_xes_from_temporary): Likewise.
(is_convertible_helper): Likewise.  Check FUNC_OR_METHOD_TYPE_P.

gcc/testsuite/ChangeLog:

* g++.dg/ext/is_convertible6.C: New test.

[Bug tree-optimization/109804] [11/12/13/14 Regression] internal compiler error in gimple-ssa-warn-access.cc

2023-05-10 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

--- Comment #9 from Marek Polacek  ---
Right.  Local unnamed enums are of the DEMANGLE_COMPONENT_UNNAMED_TYPE type,
but those don't have their subtrees filed as per cplus_demangle_fill_component.
 So I think we can't do *newc.u.s_binary.left when the type is
DEMANGLE_COMPONENT_UNNAMED_TYPE.  Maybe they need a new case in
new_delete_mismatch_p.

[Bug fortran/109788] [14 Regression] gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int since r14-377-gc92b8be9b52b7e

2023-05-10 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109788

--- Comment #11 from Jakub Jelinek  ---
If you e.g. put breakpoint on the spot I changed and stopon the testcase with
-Os when t == global_trees[TI_VOID_LIST_NODE] you can then see in e->callee the
FUNCTION_TYPE with just 5 arguments.

[Bug fortran/109788] [14 Regression] gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int since r14-377-gc92b8be9b52b7e

2023-05-10 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109788

--- Comment #10 from anlauf at gcc dot gnu.org ---
Can you tell whether you see other intrinsics with bad FUNCTION_TYPE?
E.g. if we have a similar issue with pack_char or pack_s_char?

In that case I have a vague idea why it happens, but do not yet know how
to solve this.

Regarding the prototype fix: would it be ok if we add an
__attribute__((unused))
to the affected-but-unused arguments, as that is already there for the
actual implementation?  And would that make a difference for the ABI?

[Bug tree-optimization/109804] [11/12/13/14 Regression] internal compiler error in gimple-ssa-warn-access.cc

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

--- Comment #8 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #7)
> I am suspecting the `unnamed enum` is causing the ICE.

I mean the local unnamed enums is what is exposing the ICE. Naming either of
them and the ICE goes away.

[Bug tree-optimization/109804] [11/12/13/14 Regression] internal compiler error in gimple-ssa-warn-access.cc

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

--- Comment #7 from Andrew Pinski  ---
I am suspecting the `unnamed enum` is causing the ICE.

[Bug tree-optimization/109804] [11/12/13/14 Regression] internal compiler error in gimple-ssa-warn-access.cc

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

--- Comment #6 from Andrew Pinski  ---
Note the ICE moved from maybe_emit_free_warning in expand.c in GCC 11 to
new_delete_mismatch_p in gimple-ssa-warn-access.cc in GCC 12+.

[Bug tree-optimization/109804] internal compiler error in gimple-ssa-warn-access.cc

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

--- Comment #5 from Andrew Pinski  ---
Created attachment 55044
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55044=edit
reduced as much as I could get it for the trunk (note GCC 11 fails still too)

[Bug tree-optimization/109804] internal compiler error in gimple-ssa-warn-access.cc

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2023-05-10
 Status|UNCONFIRMED |NEW

--- Comment #4 from Andrew Pinski  ---
.

[Bug tree-optimization/109804] internal compiler error in gimple-ssa-warn-access.cc

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2023-05-10 00:00:00 |
 Ever confirmed|1   |0
 Status|NEW |UNCONFIRMED
Summary|[11/12/13/14 Regression]|internal compiler error in
   |internal compiler error in  |gimple-ssa-warn-access.cc
   |gimple-ssa-warn-access.cc   |
  Known to fail||11.1.0, 12.1.0, 13.1.0,
   ||14.0

[Bug tree-optimization/109804] [11/12/13/14 Regression] internal compiler error in gimple-ssa-warn-access.cc

2023-05-10 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

--- Comment #3 from Marek Polacek  ---
Started with r11-6507

commit fd64f348a6b40621dc2bcc743f5fdfb31ed0894c
Author: Martin Sebor 
Date:   Wed Jan 6 13:36:18 2021 -0700

PR c++/98305 spurious -Wmismatched-new-delete on template instance

[Bug tree-optimization/109804] [11/12/13/14 Regression] internal compiler error in gimple-ssa-warn-access.cc

2023-05-10 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Target Milestone|--- |11.4
 CC||mpolacek at gcc dot gnu.org
   Last reconfirmed||2023-05-10
Summary|internal compiler error in  |[11/12/13/14 Regression]
   |gimple-ssa-warn-access.cc   |internal compiler error in
   ||gimple-ssa-warn-access.cc
 Ever confirmed|0   |1

--- Comment #2 from Marek Polacek  ---
Confirmed.

[Bug c++/109774] template function causes Spurious dangling reference warning while non-template does not

2023-05-10 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109774

Marek Polacek  changed:

   What|Removed |Added

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

--- Comment #2 from Marek Polacek  ---
Here it comes down to

13900 || warning_suppressed_p (fndecl, OPT_Wdangling_reference)

in do_warn_dangling_reference.  So it's about the propagation of the
suppression bits.

[Bug c++/109804] internal compiler error in gimple-ssa-warn-access.cc

2023-05-10 Thread christian.prochaska--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

--- Comment #1 from Christian Prochaska  
---
Created attachment 55043
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55043=edit
test.cc

[Bug c++/109804] New: internal compiler error in gimple-ssa-warn-access.cc

2023-05-10 Thread christian.prochaska--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

Bug ID: 109804
   Summary: internal compiler error in gimple-ssa-warn-access.cc
   Product: gcc
   Version: 13.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: christian.procha...@genode-labs.com
  Target Milestone: ---

Created attachment 55042
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55042=edit
output from -freport-bug

during GIMPLE pass: waccess
test.cc: In function ‘T* Genode::construct_at(void*, ARGS&& ...) [with T = B;
ARGS = {C::C()::&}]’:
test.cc:37:19: internal compiler error: Segmentation fault
   37 | static inline T * Genode::construct_at(void *at, ARGS &&... args)
  |   ^~
0xe67c7f crash_signal
../../gcc/toplev.cc:314
0xbb2320 new_delete_mismatch_p
../../gcc/gimple-ssa-warn-access.cc:1626
0xbb23b9 new_delete_mismatch_p
../../gcc/gimple-ssa-warn-access.cc:1724
0xbb23b9 new_delete_mismatch_p
../../gcc/gimple-ssa-warn-access.cc:1724
0xbb23b9 new_delete_mismatch_p
../../gcc/gimple-ssa-warn-access.cc:1724
0xbb23b9 new_delete_mismatch_p
../../gcc/gimple-ssa-warn-access.cc:1724
0xbb23b9 new_delete_mismatch_p
../../gcc/gimple-ssa-warn-access.cc:1724
0xbb23b9 new_delete_mismatch_p
../../gcc/gimple-ssa-warn-access.cc:1724
0xbb7720 new_delete_mismatch_p
../../gcc/gimple-ssa-warn-access.cc:1763
0xbb7720 matching_alloc_calls_p
../../gcc/gimple-ssa-warn-access.cc:1786
0xbbf214 matching_alloc_calls_p
../../gcc/gimple-ssa-warn-access.cc:1984
0xbbf214 maybe_check_dealloc_call
../../gcc/gimple-ssa-warn-access.cc:3757
0xbbf214 check_call
../../gcc/gimple-ssa-warn-access.cc:4367
0xbbf214 check_block
../../gcc/gimple-ssa-warn-access.cc:
0xbbf214 execute
../../gcc/gimple-ssa-warn-access.cc:4766

[Bug c++/109738] C++20 implicit conversion is used during spaceship operator resolution instead of class's operator< for classes without spaceship operator

2023-05-10 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109738

--- Comment #2 from Jonathan Wakely  ---
(In reply to Scott Zhong from comment #0)
> The debugger showed during resolution of spaceship operator, the implicit
> conversion to const char* for StringWrapper is selected instead of
> StringWrapper::operator<() during insertion into std::map with the key of
> std::list.

I think this is the correct C++20 behaviour.

The library checks whether lhs <=> rhs is valid, and if so, it uses that.
Otherwise, it synthesizes a three-way comparison using operator<.

Because your type is implicitly convertible to something that is three-way
comparable, the lhs <=> rhs expression is valid, and so that's what gets used.

[Bug target/92658] x86 lacks vector extend / truncate

2023-05-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92658

--- Comment #26 from CVS Commits  ---
The master branch has been updated by Uros Bizjak :

https://gcc.gnu.org/g:608e7f3ab47fe746279c552c3574147aa3d8ee76

commit r14-666-g608e7f3ab47fe746279c552c3574147aa3d8ee76
Author: Uros Bizjak 
Date:   Wed May 10 22:40:53 2023 +0200

i386: Add missing vector extend patterns [PR92658]

Add missing insn pattern for v2qi -> v2si vector extend and named
expanders to activate generation of vector extends to 8-byte and 4-byte
vectors.

gcc/ChangeLog:

PR target/92658
* config/i386/mmx.md (sse4_1_v2qiv2si2): New insn pattern.
(v4qiv4hi2): New expander.
(v2hiv2si2): Ditto.
(v2qiv2si2): Ditto.
(v2qiv2hi2): Ditto.

gcc/testsuite/ChangeLog:

PR target/92658
* gcc.target/i386/pr92658-sse4-4b.c: New test.
* gcc.target/i386/pr92658-sse4-8b.c: New test.

[Bug c++/109803] [12 Regression] ICE with type defined in lambda inside generic lambda inside function template

2023-05-10 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109803

Marek Polacek  changed:

   What|Removed |Added

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

--- Comment #2 from Marek Polacek  ---
Let's reopen the other bug.

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

[Bug c++/109241] [13 Regression] ICE Segmentation fault for statement expression with a local type inside inside a generic lambda inside a generic lambda since r13-6722-gb323f52ccf966800

2023-05-10 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109241

Marek Polacek  changed:

   What|Removed |Added

 CC||rs2740 at gmail dot com

--- Comment #6 from Marek Polacek  ---
*** Bug 109803 has been marked as a duplicate of this bug. ***

[Bug c++/109241] [13 Regression] ICE Segmentation fault for statement expression with a local type inside inside a generic lambda inside a generic lambda since r13-6722-gb323f52ccf966800

2023-05-10 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109241

Marek Polacek  changed:

   What|Removed |Added

 Resolution|FIXED   |---
 CC||mpolacek at gcc dot gnu.org
 Status|RESOLVED|REOPENED

--- Comment #5 from Marek Polacek  ---
In GCC 12 this test still ICEs:

template
void foo(T) {
[](auto){
[] {
struct X {};
};
};
}

template void foo(int);

[Bug c++/109803] [12 Regression] ICE with type defined in lambda inside generic lambda inside function template

2023-05-10 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109803

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek  ---
This is bug 109241 I think.  In GCC 13 it was fixed by

commit r13-6824-g4872e46e080c6695dfe1f9dc9db26b4703bc348c
Author: Jason Merrill 
Date:   Wed Mar 22 16:11:47 2023 -0400

c++: local class in nested generic lambda [PR109241]

[Bug c++/109803] [12 Regression] ICE with type defined in lambda inside generic lambda inside function template

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109803

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
   Target Milestone|--- |12.4
  Known to work||12.2.0
  Known to fail||12.3.0, 13.1.0, 14.0

[Bug c++/109803] New: [12 Regression] ICE with type defined in lambda inside generic lambda inside function template

2023-05-10 Thread rs2740 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109803

Bug ID: 109803
   Summary: [12 Regression] ICE with type defined in lambda inside
generic lambda inside function template
   Product: gcc
   Version: 12.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rs2740 at gmail dot com
  Target Milestone: ---

Repro:

template
void foo(T) {
[](auto){
[] {
struct X {};
};
};
}

template void foo(int);

: In instantiation of 'void foo(T) [with T = int]':
:10:22:   required from here
:4:9: internal compiler error: Segmentation fault
4 | [] {
  | ^
0x1bbabfe internal_error(char const*, ...)
???:0
0x10b0223 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*))
???:0
0x10b0516 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*))
???:0
0x10b0223 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*))
???:0
0x870a79 check_for_bare_parameter_packs(tree_node*, unsigned int)
???:0
0x8a7dfb finish_expr_stmt(tree_node*)
???:0
0x891a08 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x87e337 instantiate_decl(tree_node*, bool, bool)
???:0
0x899e8b instantiate_pending_templates(int)
???:0
0x7a5298 c_parse_final_cleanups()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

https://gcc.godbolt.org/z/sb5crbxf6

This is a regression in 12.3.0. 12.2.0 and 13.1.0 both compile this fine.

[Bug c++/109751] [13/14 Regression] boost iterator_interface fails concept check starting in gcc-13

2023-05-10 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109751

--- Comment #21 from Patrick Palka  ---
(In reply to Luke Dalessandro from comment #15)
> 3. A fix for this issue in boost and the iterator_interface is to use a
> constrained member function rather than attempting to use a constrained
> friend function?

IIUC yes, or another less invasive workaround would be to convert the
constrained hidden friend into a template, e.g.

template concept cmpeq
  = requires(_Tp __t, _Tp __u) { { __u != __t } ; };
template
struct iterator_interface
{
  template
  friend constexpr bool operator>=(D lhs, D rhs) requires cmpeq { return
true; }
};
template
struct iterator : iterator_interface>
{
bool operator==(iterator) const;
iterator ++();
iterator ++(int);
};
static_assert(cmpeq>);

[Bug tree-optimization/107888] [12/13/14 Regression] Missed min/max transformation in phiopt due to VRP

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107888

Andrew Pinski  changed:

   What|Removed |Added

  Attachment #55026|0   |1
is obsolete||

--- Comment #10 from Andrew Pinski  ---
Created attachment 55041
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55041=edit
Patch that actually works

Here is the patch which actually works. The two testcases that I pushed
recently have been falls out of messing up on the patch.

[Bug fortran/109624] dump-parse-tree prints attributes with unbalanced braces

2023-05-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109624

--- Comment #1 from CVS Commits  ---
The master branch has been updated by Bernhard Reutner-Fischer
:

https://gcc.gnu.org/g:39f7c0963a9c009e6c9b98e95dbba31cccb07329

commit r14-664-g39f7c0963a9c009e6c9b98e95dbba31cccb07329
Author: Bernhard Reutner-Fischer 
Date:   Tue May 9 17:21:16 2023 +0200

Fortran: dump-parse-tree attribs: fix unbalanced braces [PR109624]

gcc/fortran/ChangeLog:

PR fortran/109624
* dump-parse-tree.cc (debug): New function for gfc_namespace.
(gfc_debug_code): Delete forward declaration.
(show_attr): Make sure to print balanced braces.

[Bug fortran/109788] [14 Regression] gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int since r14-377-gc92b8be9b52b7e

2023-05-10 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109788

--- Comment #9 from Jakub Jelinek  ---
Of course, if libgfortran plans to bump soname for GCC 14, that would be ok,
but not ok otherwise (you could e.g. keep the old symbol as is and add a
differently named entrypoint that used the new prototype).
But, as I wrote, the size_t vs. integer(kind=4) difference isn't the only
problem, the other is that the FUNCTION_TYPE created in the FE for the function
has just 5 arguments instead of 6 for some reason.

[Bug fortran/109788] [14 Regression] gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int since r14-377-gc92b8be9b52b7e

2023-05-10 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109788

--- Comment #8 from Jakub Jelinek  ---
That feels like ABI incompatible change.

[Bug fortran/109788] [14 Regression] gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int since r14-377-gc92b8be9b52b7e

2023-05-10 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109788

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 CC||anlauf at gcc dot gnu.org

--- Comment #7 from anlauf at gcc dot gnu.org ---
Created attachment 55040
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55040=edit
libgfortran patch

It appears that the prototypes of the character variants of the SPREAD
intrinsic were not updated at the time when the character length type
was changed from int to size_t.

Does the attached patch fix your observation?

[Bug analyzer/109802] [regression] during IPA pass: analyzer: internal compiler error (using dubious flexible arrays in unions)

2023-05-10 Thread alx at kernel dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109802

--- Comment #4 from Alejandro Colomar  ---
(In reply to Alejandro Colomar from comment #3)
> Hmm, I should have used offsetof(3) in a few placed to avoid issues due to
> padding, but I was lucky :).

Oh, no, I didn't need it.  I got it right.  Never mind.

[Bug target/109797] 456.hmmer compiled with -O2 -flto regressed by 15% on AMD zen3 between r14-487-g6f18f344338b37 and r14-540-gb7fe38c14e5f1b

2023-05-10 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109797

--- Comment #3 from Uroš Bizjak  ---
(In reply to Andrew Pinski from comment #1)
> Maybe:
> https://gcc.gnu.org/git/?p=gcc.git;a=commit;
> h=919642fa4b2bc4c32910336dd200d53766801c80

Is this with -msse4? In case of TARGET_SSE4_1 the revision just emits PMULLD,
otherwise it emits PMULUDQ with corresponding PUNPCKLDQ and PSHUFD shuffles.

[Bug analyzer/109802] [regression] during IPA pass: analyzer: internal compiler error (using dubious flexible arrays in unions)

2023-05-10 Thread alx at kernel dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109802

--- Comment #3 from Alejandro Colomar  ---
Hmm, I should have used offsetof(3) in a few placed to avoid issues due to
padding, but I was lucky :).

[Bug tree-optimization/107888] [12/13/14 Regression] Missed min/max transformation in phiopt due to VRP

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107888

--- Comment #9 from Andrew Pinski  ---
By the way this does show up in GCC itself.
in worse_state in ipa-pure-const.cc where it does MAX of bools

and for x86's internal_min_issue_delay in insn-automata.cc
The below is the similar code to what is there:
unsigned f(unsigned temp1, unsigned temp2)
{
  unsigned temp, res;
  temp = temp1 & 3;
  res = temp;

  temp = temp2 & 1;
  if (temp > res)
res = temp;
  return res;
}

[Bug analyzer/109802] [regression] during IPA pass: analyzer: internal compiler error (using dubious flexible arrays in unions)

2023-05-10 Thread colomar.6.4.3 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109802

--- Comment #2 from Alejandro Colomar  ---
Here's a simplified version that will cause the same internal compiler error.
This one will probably cause less brain damage to readers,
as it has significantly less magic.


$ cat flexi2.c 
#include 
#include 
#include 
#include 

struct s {
int x;
ptrdiff_t off[0];
};

int
main(void)
{
char  *p;
struct s  *s;

s = malloc(sizeof(struct s) +
   sizeof(ptrdiff_t) * 2 +
   sizeof("foo") + sizeof("bar"));

p = (void *) s + sizeof(struct s) + sizeof(ptrdiff_t) * 2;

s->off[0] = p - (char *) s;
p = stpcpy(p, "foo") + 1;
s->off[1] = p - (char *) s;
p = stpcpy(p, "bar") + 1;

puts((char *) s + s->off[0]);
puts((char *) s + s->off[1]);
}


$ gcc-12 -Wall -Wextra -Werror -fanalyzer -O3 flexi2.c 
$ ./a.out 
foo
bar
$ gcc-13 -Wall -Wextra -Werror -O3 flexi2.c 
$ ./a.out 
foo
bar
$ gcc-13 -Wall -Wextra -Werror -fanalyzer -O3 flexi2.c 
during IPA pass: analyzer
flexi2.c: In function ‘main’:
flexi2.c:29:33: internal compiler error: in make, at analyzer/store.cc:132
   29 | puts((char *) s + s->off[1]);
  |   ~~^~~
0xcec8a5 ana::binding_key::make(ana::store_manager*, ana::region const*)
../../src/gcc/analyzer/store.cc:132
0xcf9533 ana::binding_cluster::get_binding(ana::store_manager*, ana::region
const*) const
../../src/gcc/analyzer/store.cc:1567
0xcf95eb ana::binding_cluster::get_binding_recursive(ana::store_manager*,
ana::region const*) const
../../src/gcc/analyzer/store.cc:1604
0xd05e49 ana::binding_cluster::get_any_binding(ana::store_manager*, ana::region
const*) const
../../src/gcc/analyzer/store.cc:1627
0xcd45f7 ana::region_model::get_store_value(ana::region const*,
ana::region_model_context*) const
../../src/gcc/analyzer/region-model.cc:2407
0xcd4e72 ana::region_model::get_rvalue(ana::path_var,
ana::region_model_context*) const
../../src/gcc/analyzer/region-model.cc:2297
0xcd6a5c ana::region_model::on_assignment(gassign const*,
ana::region_model_context*)
../../src/gcc/analyzer/region-model.cc:1156
0xcdc2da ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode
const*, gimple const*, ana::program_state*, ana::uncertainty_t*,
ana::path_context*)
../../src/gcc/analyzer/engine.cc:1471
0xcdc877 ana::exploded_graph::process_node(ana::exploded_node*)
../../src/gcc/analyzer/engine.cc:4063
0xcdd8b9 ana::exploded_graph::process_worklist()
../../src/gcc/analyzer/engine.cc:3466
0xcddc57 ana::impl_run_checkers(ana::logger*)
../../src/gcc/analyzer/engine.cc:6125
0xcde4ff ana::run_checkers()
../../src/gcc/analyzer/engine.cc:6213
0xcde54b execute
../../src/gcc/analyzer/analyzer-pass.cc:87
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.


I didn't attach the preprocessed source of this simplified example, since I
guess it would be repetitive with the previous one.

[Bug analyzer/109802] [regression] during IPA pass: analyzer: internal compiler error (using dubious flexible arrays in unions)

2023-05-10 Thread colomar.6.4.3 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109802

--- Comment #1 from Alejandro Colomar  ---
Please use this:

Reported-by: Alejandro Colomar 

[Bug analyzer/109802] New: [regression] during IPA pass: analyzer: internal compiler error (using dubious flexible arrays in unions)

2023-05-10 Thread colomar.6.4.3 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109802

Bug ID: 109802
   Summary: [regression] during IPA pass: analyzer: internal
compiler error (using dubious flexible arrays in
unions)
   Product: gcc
   Version: 13.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: colomar.6.4.3 at gmail dot com
  Target Milestone: ---

Created attachment 55039
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55039=edit
preprocessed_source

Hi!

I was compiling some reduced version of some nasty code I found in a project,
to see
what GCC has to say about it.  I'm not sure if it has defined behavior or not,
according to strict-aliasing rules.  That code managed to get GCC on its knees
:)


$ cat flexi.c 
#include 
#include 
#include 
#include 

union u {
char   base[0];
ptrdiff_t  off;
};

struct s {
int x;
union u u[0];
};

int
main(void)
{
char  *p;
struct s  *s;

s = malloc(sizeof(struct s) +
   sizeof(union u) * 2 +
   sizeof("foo") + sizeof("bar"));

p = (void *) s + sizeof(struct s) + sizeof(union u) * 2;

s->u[0].off = p - s->u[0].base;
p = stpcpy(p, "foo") + 1;
s->u[1].off = p - s->u[1].base;
p = stpcpy(p, "bar") + 1;

puts(s->u[0].base + s->u[0].off);
puts(s->u[1].base + s->u[1].off);
}


$ gcc-12 -Wall -Wextra -Werror -fanalyzer -O3 flexi.c
$ ./a.out 
foo
bar


$ gcc-13 -Wall -Wextra -Werror -fanalyzer -O3 flexi.c -freport-bug
during IPA pass: analyzer
flexi.c: In function ‘main’:
flexi.c:34:36: internal compiler error: in make, at analyzer/store.cc:132
   34 | puts(s->u[1].base + s->u[1].off);
  | ~~~^~~~
0xcec8a5 ana::binding_key::make(ana::store_manager*, ana::region const*)
../../src/gcc/analyzer/store.cc:132
0xcf9533 ana::binding_cluster::get_binding(ana::store_manager*, ana::region
const*) const
../../src/gcc/analyzer/store.cc:1567
0xcf95eb ana::binding_cluster::get_binding_recursive(ana::store_manager*,
ana::region const*) const
../../src/gcc/analyzer/store.cc:1604
0xd05e49 ana::binding_cluster::get_any_binding(ana::store_manager*, ana::region
const*) const
../../src/gcc/analyzer/store.cc:1627
0xcd45f7 ana::region_model::get_store_value(ana::region const*,
ana::region_model_context*) const
../../src/gcc/analyzer/region-model.cc:2407
0xcd4e72 ana::region_model::get_rvalue(ana::path_var,
ana::region_model_context*) const
../../src/gcc/analyzer/region-model.cc:2297
0xcd6a5c ana::region_model::on_assignment(gassign const*,
ana::region_model_context*)
../../src/gcc/analyzer/region-model.cc:1156
0xcdc2da ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode
const*, gimple const*, ana::program_state*, ana::uncertainty_t*,
ana::path_context*)
../../src/gcc/analyzer/engine.cc:1471
0xcdc877 ana::exploded_graph::process_node(ana::exploded_node*)
../../src/gcc/analyzer/engine.cc:4063
0xcdd8b9 ana::exploded_graph::process_worklist()
../../src/gcc/analyzer/engine.cc:3466
0xcddc57 ana::impl_run_checkers(ana::logger*)
../../src/gcc/analyzer/engine.cc:6125
0xcde4ff ana::run_checkers()
../../src/gcc/analyzer/engine.cc:6213
0xcde54b execute
../../src/gcc/analyzer/analyzer-pass.cc:87
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See  for instructions.
Preprocessed source stored into /tmp/ccZKUz79.out file, please attach this to
your bugreport.


You'll find attached the file produced by GCC, as per its own instructions.

[Bug tree-optimization/109801] -Wmaybe-uninitialized warning with -O1 on move constructor

2023-05-10 Thread szhong at perforce dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109801

--- Comment #2 from Scott Zhong  ---
Constructing a container and then moving it to a second container causes this
warning to popup. In this case, container1 is not temporary.

int main()
{
table container1;
// (... do something with container1 ...)
table container2(std::move(container1));
return (0);
}

[Bug tree-optimization/109801] -Wmaybe-uninitialized warning with -O1 on move constructor

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109801

--- Comment #1 from Andrew Pinski  ---
Note in GCC 13 and above we give an extra warning too:
: In function 'int main()':
:30:49: warning: moving a temporary object prevents copy elision
[-Wpessimizing-move]
   30 | table container(std::move(table()));
  | ^
:30:49: note: remove 'std::move' call

[Bug c++/109801] New: -Wmaybe-uninitialized warning with -O1 on move constructor

2023-05-10 Thread szhong at perforce dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109801

Bug ID: 109801
   Summary: -Wmaybe-uninitialized warning with -O1 on move
constructor
   Product: gcc
   Version: 12.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: szhong at perforce dot com
  Target Milestone: ---

Created attachment 55038
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55038=edit
preprocessed file

-O1 flag is causing the -Wmaybe-uninitialized warning on move constructor.

testcase:

#include 

template 
class list
{
public:
list();
~list();
};

template 
class table
{
public:
table()
   : buckets_(64), size_(0) {}
table(table&& other) {
std::swap(buckets_, other.buckets_);
std::swap(size_, other.size_);
}
~table() {}
private:
std::vector > buckets_;
int size_;
};

int main()
{
table container(std::move(table()));
return (0);
}

$ g++ -v -save-temps -O1 -Wmaybe-uninitialized -c table.cpp
Using built-in specs.
COLLECT_GCC=g++
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,lto --prefix=/opt/rh/gcc-toolset-12/root/usr
--mandir=/opt/rh/gcc-toolset-12/root/usr/share/man
--infodir=/opt/rh/gcc-toolset-12/root/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --enable-libstdcxx-backtrace
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-12.1.1-20220628/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-offload-defaulted --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_64=x86-64-v2 --with-arch_32=x86-64
--build=x86_64-redhat-linux --with-build-config=bootstrap-lto
--enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.1 20220628 (Red Hat 12.1.1-3) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O1' '-Wmaybe-uninitialized' '-c'
'-shared-libgcc' '-mtune=generic' '-march=x86-64-v2'
 /opt/rh/gcc-toolset-12/root/usr/libexec/gcc/x86_64-redhat-linux/12/cc1plus -E
-quiet -v -D_GNU_SOURCE table.cpp -mtune=generic -march=x86-64-v2
-Wmaybe-uninitialized -O1 -fpch-preprocess -o table.ii
ignoring nonexistent directory
"/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/include-fixed"
ignoring nonexistent directory
"/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:

/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12

/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/x86_64-redhat-linux

/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/backward
 /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/include
 /usr/local/include
 /opt/rh/gcc-toolset-12/root/usr/include
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O1' '-Wmaybe-uninitialized' '-c'
'-shared-libgcc' '-mtune=generic' '-march=x86-64-v2'
 /opt/rh/gcc-toolset-12/root/usr/libexec/gcc/x86_64-redhat-linux/12/cc1plus
-fpreprocessed table.ii -quiet -dumpbase table.cpp -dumpbase-ext .cpp
-mtune=generic -march=x86-64-v2 -O1 -Wmaybe-uninitialized -version -o table.s
GNU C++17 (GCC) version 12.1.1 20220628 (Red Hat 12.1.1-3)
(x86_64-redhat-linux)
compiled by GNU C version 12.1.1 20220628 (Red Hat 12.1.1-3), GMP
version 6.2.0, MPFR version 4.1.0-p9, MPC version 1.2.1, isl version
isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++17 (GCC) version 12.1.1 20220628 (Red Hat 12.1.1-3)
(x86_64-redhat-linux)
compiled by GNU C version 12.1.1 20220628 (Red Hat 12.1.1-3), GMP
version 6.2.0, MPFR version 4.1.0-p9, MPC version 1.2.1, isl version
isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4fe953bdd6603241811586d9fd73a7cb
In file included from
/opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_pair.h:61,
 from
/opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_algobase.h:64,
 from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/vector:60,
 from table.cpp:1:
In function \u2018std::_Require >,
std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&,
_Tp&) [with _Tp = int]\u2019,
inlined from 

[Bug target/109800] New: [11/12/13/14 Regression] arm: ICE (segfault) loading double with -mpure-code -mbig-endian

2023-05-10 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109800

Bug ID: 109800
   Summary: [11/12/13/14 Regression] arm: ICE (segfault) loading
double with -mpure-code -mbig-endian
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

The following fails:

$ cat t.c
double f() { return 5.0; }
$ gcc/xgcc -B gcc -c -S -o /dev/null -O2 -march=armv7-m -mfloat-abi=hard
-mfpu=fpv4-sp-d16 -mbig-endian -mpure-code t.c
xgcc: internal compiler error: Segmentation fault signal terminated program cc1
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See  for instructions.

It started with r11-966-g9a182ef9ee011935d827ab5c6c9a7cd8e22257d8 .

Looking at the dumpfile 291r.split1, it looks like we end up splitting
indefinitely:

;; Function f (f, funcdef_no=0, decl_uid=5948, cgraph_uid=1, symbol_order=0)

Splitting with gen_split_111 (vfp.md:2138)
scanning new insn with uid = 12.
scanning new insn with uid = 13.
deleting insn with uid = 9.
Splitting with gen_split_111 (vfp.md:2138)
scanning new insn with uid = 14.
scanning new insn with uid = 15.
deleting insn with uid = 12.
Splitting with gen_split_111 (vfp.md:2138)
scanning new insn with uid = 16.
scanning new insn with uid = 17.
deleting insn with uid = 14.

I think we can adjust the splitter to avoid the new simplification introduced
above from undoing our subreg punning.

[Bug c++/109799] *= used in a declaration when trying to do default argument with a pointer type could give a better error message

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109799

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug c++/109799] New: *= used in a declaration when trying to do default argument with a pointer type could give a better error message

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109799

Bug ID: 109799
   Summary: *= used in a declaration when trying to do default
argument with a pointer type could give a better error
message
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Keywords: diagnostic
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
int f(int*=nullptr);
```
Currently GCC gives not so helpful error message:
:1:10: error: expected ',' or '...' before '*=' token
1 | int f(int*=nullptr);
  |  ^~


I was trying to figure out what I did wrong before I realized that `*=` is a
single token and there needs to be white space between the `*` and the `=`. GCC
could figure out that `*=` usage in this context was supposed to be the two
token version. 

Note clang gives an even worse error message:
:1:10: error: expected ')'
int f(int*=nullptr);
 ^
:1:6: note: to match this '('
int f(int*=nullptr);
 ^

[Bug ada/109798] New: Gnat Bug Detected

2023-05-10 Thread aj at ianozi dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109798

Bug ID: 109798
   Summary: Gnat Bug Detected
   Product: gcc
   Version: 12.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
  Assignee: unassigned at gcc dot gnu.org
  Reporter: aj at ianozi dot com
CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Steps to reproduce:
1) Create test program called "testing.adb" with the following contents:
```
pragma Ada_2022;
procedure Testing is
   type Test_Enum is (apple, orange, banana);
   type Test_Type is record
  The_Type : Test_Enum;
  The_Value : Integer;
   end record;
   type Test_Array is array (Positive range <>) of Test_Type;

   My_Array : Test_Array (1 .. 6) := ( (apple, 5), (orange, 10), (banana, 1),
(orange, 15), (orange, 12), (apple, 5) );
begin

   for I in My_Array'Range
  when My_Array (I).The_Type /= orange
   loop
  null;
   end loop;

end Testing;
```
2) Compile with gcc 12.0 or greater (I tested it with both gcc 12.2.0 or MacOS
and Debian)

The following output occurs and it fails:
```
ⓘ Building testing/testing.gpr...
Compile
   [Ada]  testing.adb
+===GNAT BUG DETECTED==+
| 12.1.0 (x86_64-apple-darwin19.6.0) GCC error:|
| in gnat_to_gnu_entity, at ada/gcc-interface/decl.cc:472  |
| Error detected at testing.adb:13:21  |
| Compiling /Users/ianozi/projects/testing/testing/src/testing.adb |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .  |
| Use a subject line meaningful to you and us to track the bug.|
| Include the entire contents of this bug box in the report.   |
| Include the exact command that you entered.  |
| Also include sources listed below.   |
+==+

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

/Users/ianozi/projects/testing/testing/src/testing.adb

testing.adb:10:04: warning: "My_Array" is not modified, could be declared
constant [-gnatwk]
testing.adb:10:38: warning: array aggregate using () is an obsolescent syntax,
use [] instead [-gnatwj]
testing.adb:10:39: (style) space not allowed
compilation abandoned

   compilation of testing.adb failed

gprbuild: *** compilation phase failed
error: Command ["gprbuild", "-s", "-j0", "-p", "-P",
"/Users/ianozi/projects/testing/testing/testing.gpr"] exited with code 4
error: Compilation failed.
```

I get the same thing on debian, except the gnat bug detected says
```
| 12.2.0 (x86_64-pc-linux-gnu) GCC error:  |
| in gnat_to_gnu_entity, at ada/gcc-interface/decl.cc:472  |
```

Instead of the apple-darwin stuff.

The same thing happens if I remove the "pragma Ada_2022;" from the beginning of
the program and just compile it with the gnat2022 switch. 

Is this happening for anyone else?
I apologize if I'm filing this bug wrong, or if it's a duplicate, it's the
first time I'm doing this.

Kind regards,
AJ.

[Bug target/109797] 456.hmmer compiled with -O2 -flto regressed by 15% on AMD zen3 between r14-487-g6f18f344338b37 and r14-540-gb7fe38c14e5f1b

2023-05-10 Thread jamborm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109797

Martin Jambor  changed:

   What|Removed |Added

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

--- Comment #2 from Martin Jambor  ---
Probably a good guess, on a different zen3 based machine, the revision
r14-493-g919642fa4b2bc4 makes the run-time of 456.hmmer grow by 10%

[Bug tree-optimization/109695] [14 Regression] crash in gimple_ranger::range_of_expr since r14-377-gc92b8be9b52b7e

2023-05-10 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109695

--- Comment #33 from Jakub Jelinek  ---
That would indeed simplify things and auto_vec member would be unnecessary, nor
any of the length/allocated members etc.  All we'd need is just a pointer and
small size buffer (and is_small check would be pointer == _size_buffer).

[Bug target/109797] 456.hmmer compiled with -O2 -flto regressed by 15% on AMD zen3 between r14-487-g6f18f344338b37 and r14-540-gb7fe38c14e5f1b

2023-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109797

--- Comment #1 from Andrew Pinski  ---
Maybe:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=919642fa4b2bc4c32910336dd200d53766801c80

[Bug target/109797] New: 456.hmmer compiled with -O2 -flto regressed by 15% on AMD zen3 between r14-487-g6f18f344338b37 and r14-540-gb7fe38c14e5f1b

2023-05-10 Thread jamborm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109797

Bug ID: 109797
   Summary: 456.hmmer compiled with -O2 -flto regressed by 15% on
AMD zen3 between r14-487-g6f18f344338b37 and
r14-540-gb7fe38c14e5f1b
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jamborm at gcc dot gnu.org
Blocks: 26163
  Target Milestone: ---

The SPEC 2006 benchmark compiled with -O2 and -flto regressed by 14% on Zen3 as
can be seen at:

https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=469.180.0

Unfortunately I cannot see a similar issue on other machines, not even on zen2
or the Intel x86_64 we run benchmarks on.  (That is why I chose the component
to be target even though it is little more than a wild guess.)


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
[Bug 26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)

[Bug target/109796] New: 548.exchange2_r compiled with -O2 -flto regressed by 5% on aarch64 between r14-135-gd06e9264b0192c and r14-192-g636e2273aec555

2023-05-10 Thread jamborm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109796

Bug ID: 109796
   Summary: 548.exchange2_r compiled with -O2 -flto regressed by
5% on aarch64 between r14-135-gd06e9264b0192c and
r14-192-g636e2273aec555
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jamborm at gcc dot gnu.org
Blocks: 26163
  Target Milestone: ---
  Host: aarch64-linux
Target: aarch64-linux

The slowdown can be seen clearly at

https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=581.407.0

Fortran at -O2 may not be super important and the slowdown is not huge but it
looks very stable so maybe worth a look.  I do not see any similar regression
on a different architecture or configuration.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
[Bug 26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)

[Bug c++/97700] Bogus error when a class containing a function pointer is used as a non-type template parameter

2023-05-10 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97700

Patrick Palka  changed:

   What|Removed |Added

 CC||ppalka at gcc dot gnu.org

--- Comment #6 from Patrick Palka  ---
Partially fixed by r13-6970-gb5e38b1c166357

[Bug c/109393] Very trivial address calculation does not fold

2023-05-10 Thread manolis.tsamis at vrull dot eu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109393

--- Comment #4 from manolis.tsamis at vrull dot eu ---
(In reply to Richard Biener from comment #3)
> It's probably a mismatch of GENERIC/GIMPLE folding.  In this case it's
> pointer_int_sum prematurely distributing the multiplication:
> 
> /* Return a tree for the sum or difference (RESULTCODE says which)
>of pointer PTROP and integer INTOP.  */
> 
> tree  
> pointer_int_sum (location_t loc, enum tree_code resultcode,
>  tree ptrop, tree intop, bool complain)
> { 
> ...
>   /* If what we are about to multiply by the size of the elements
>  contains a constant term, apply distributive law
>  and multiply that constant term separately.
>  This helps produce common subexpressions.  */
> 
> but this kind of stuff shouldn't be done by the frontends these days.
> 
> Gating this fixes the issue.  I think this piece of code should be axed
> (after careful evaluation of its effect)

I have been testing this change and by looking at some tests that it causes to
fail, there is a regression on testcases like this (taken from
copy-headers-5.c, there are some similar fails):

int is_sorted(int *a, int n)
{
  for (int i = 0; i < n - 1; i++)
if (a[i] > a[i + 1])
  return 0;
  return 1;
}

The gimple code for gcc currently is (taken from dump-tree-ch2):
  _1 = (long unsigned int) i_18;
  _2 = _1 * 4;
  _3 = a_13(D) + _2;
  _4 = *_3;
  _5 = _1 + 1;
  _6 = _5 * 4;
  _7 = a_13(D) + _6;
  _8 = *_7;

While with this change the result is:
  _1 = (long unsigned int) i_11;
  _2 = _1 * 4;
  _3 = a_14(D) + _2;
  _4 = *_3;
  _5 = i_11 + 1;
  _6 = (long unsigned int) _5;
  _7 = _6 * 4;
  _8 = a_14(D) + _7;
  _9 = *_8;

As a result the generated code has two loads per loop instead of one. 

The same holds if e.g. a[i + 1] > a[i + 2] is used because the constant
addition is done before the cast to long unsigned int. I believe this is
because the logic to distribute the constant is missing as a GIMPLE pattern?
Given the original transform it should be valid to propagate the constant
addition through the cast?

[Bug rtl-optimization/109009] Shrink Wrap missed opportunity

2023-05-10 Thread jskumari at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109009

--- Comment #6 from Surya Kumari Jangala  ---
Continuing with the analysis of the test cases specified in comment 5, here are
some findings:

After graph colouring, when we do improve_allocation(), we find that in the
failing test case, the hard_reg_cost[r31] for allocno r118 is 0. (Note: not
just r31, for several other registers the cost is 0). The cost for r3 is 2390.

I spent some time investigating why the hard_reg_cost is 0. In the failing
test, the hard_reg_cost[] array is initialized to ALLOCNO_CLASS_COST in the
routine setup_allocno_class_and_costs(). ALLOCNO_CLASS_COST for allocno r118 is
0.

In the passing test, the hard_reg_cost[] array is initialized to
ALLOCNO_CLASS_COST in the routine process_bb_node_for_hard_reg_moves().
ALLOCNO_CLASS_COST is 2000 for allocno r117.

The reason the initialization happens in a different routine in the passing and
failing tests is because the preferred register class is different from the
allocno class in the failing case (the former is BASE_REGS while the latter is
GENERAL_REGS), while in the passing case both are same (GENERAL_REGS).

ALLOCNO_CLASS_COST is minimal accumulated register class cost of the allocno
class.

In the failing case, while the initial value of hard_reg_cost[r3] is 0, it is
changed in the following routines:
1. ira_tune_allocno_costs() : 0->2640
 (this routine checks if the register is caller save and if it is live across a
call. r3 is caller save while r31 is not. So, only cost for r3 is changed.)
2. process_regs_for_copy() : 2640->2390
 (this routine processes the 'set r3, r118+1' insn and reduces the cost of r3
in order to make it more preferential for r118. Again, cost of r31 is not
changed as there is no insn involving r31 & r118)

Even though r31 has 0 cost, r3 is chosen to be assigned to r118 because r31 is
a callee save register and it's use will have save/restore cost.

In the passing case, both r31 and r3 initially have a cost of 2000. 

The cost for r3 is then changed in the following routines:
1. process_bb_node_for_hard_reg_moves() : 2000->0
 (the cost is reduced in order to give preference to r3 for allocno r117.
This is due to the 'set r3, r117' insn)
2. ira_tune_allocno_costs () : 0->2640
3. process_regs_for_copy() : 2640->640

r3 is chosen for allocno r117 as it has lesser cost than r31.

Next, I checked why ALLOCNO_CLASS_COST is 0 in the failing case while in the
passing case it is 2000.

In the routine find_costs_and_classes(), we compute the cost of each register
class for each allocno. First we go thru all the insns in the routine. Then for
each insn which involves a copy from/to a hard reg to/from a pseudo reg, we
compute the cost of the 'move' if the pseudo is assigned a register from a
specific register class. This cost is the register class cost of this allocno
for this specific insn. We add up all such costs to get the register class cost
for an allocno.

In the passing case, we have the insn 'set r3, r117' which is processed in
find_costs_and_classes(). For this insn, we check the cost of the move if r117
is assigned to different register classes. The minimum of these costs is the
ALLOCNO_CLASS_COST for r117.

But in the failing case, there is no 'set' insn involving a hard register and
the pseudo register r118. So the ALLOCNO_CLASS_COST is 0.

[Bug fortran/109788] [14 Regression] gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int since r14-377-gc92b8be9b52b7e

2023-05-10 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109788

--- Comment #6 from Jakub Jelinek  ---
What remains is some Fortran FE change.  The function seems to be called with 6
arguments that the runtime actually expects, so there is some chance that it
works, but
some of the arguments have incompatible types (integer(kind=8) vs.
GFC_INTEGER_4) and the FUNCTION_TYPE contains just 5 arguments rather than 6.

[Bug fortran/109788] [14 Regression] gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int since r14-377-gc92b8be9b52b7e

2023-05-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109788

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

https://gcc.gnu.org/g:395a75593ef87a68a04111bb08243b5d9a811f45

commit r14-656-g395a75593ef87a68a04111bb08243b5d9a811f45
Author: Jakub Jelinek 
Date:   Wed May 10 13:20:39 2023 +0200

ipa-prop: Fix ipa_get_callee_param_type for calls with argument type
mismatches

The PR contains a testcase where the Fortran FE creates FUNCTION_TYPE
which doesn't really match the passed in arguments (FUNCTION_TYPE has
5 arguments, call has 6).  Now, I think that is a Fortran FE bug that
should be fixed there, but I think with function pointers one can
create something similar (of course invalid) in C/C++ too,so IMHO IPA
should be also more careful.
The ipa_get_callee_param_type function can return NULL if something goes
wrong and it does e.g. if asked for 7th argument type on a function
with just 5 arguments and similar.  But, if a function isn't varargs,
when asked for 6th argument type on a function with just 5 arguments
it actually returns void_type_node because the argument list is in that
case terminated with void_list_node.

The following patch makes sure we don't treat void_list_node as something
holding another argument.

2023-05-10  Jakub Jelinek  

PR fortran/109788
* ipa-prop.cc (ipa_get_callee_param_type): Don't return TREE_VALUE
(t)
if t is void_list_node.

[Bug tree-optimization/109759] UBSAN error: shift exponent 64 is too large for 64-bit type 'long unsigned int'

2023-05-10 Thread jamborm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109759

--- Comment #2 from Martin Jambor  ---
Likely a duplicate of PR 109788.

I'll close the bug as such if it does not manifest itself over the weekend
ubsan bootstrap.

[Bug ada/108157] [12/13/14 regression] object subtype doesn't statically match designated subtype

2023-05-10 Thread simon at pushface dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108157

--- Comment #2 from simon at pushface dot org ---
Still present in 13.1.0.

[Bug target/99195] Optimise away vec_concat of 64-bit AdvancedSIMD operations with zeroes in aarch64

2023-05-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99195

--- Comment #13 from CVS Commits  ---
The master branch has been updated by Kyrylo Tkachov :

https://gcc.gnu.org/g:3ed5677bb61b334a2d01c769859cdd3279e12a07

commit r14-654-g3ed5677bb61b334a2d01c769859cdd3279e12a07
Author: Kyrylo Tkachov 
Date:   Wed May 10 12:00:17 2023 +0100

[PATCH] aarch64: PR target/99195 annotate simple permutation patterns for
vec-concat-zero

Another straightforward patch annotating patterns for the zip1, zip2, uzp1,
uzp2, rev* instructions, plus tests.
Bootstrapped and tested on aarch64-none-linux-gnu and aarch64_be-none-elf.

gcc/ChangeLog:

PR target/99195
* config/aarch64/aarch64-simd.md
(aarch64_):
Rename to...
(aarch64_): ... This.
(aarch64_rev): Rename to...
(aarch64_rev): ... This.

gcc/testsuite/ChangeLog:

PR target/99195
* gcc.target/aarch64/simd/pr99195_1.c: Add tests for zip and rev
intrinsics.

[Bug libgcc/109670] [13/14 regression] Exception handling broken for 32-bit Windows

2023-05-10 Thread tneumann at users dot sourceforge.net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109670

--- Comment #12 from Thomas Neumann  ---
Created attachment 55037
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55037=edit
radix sort fix

I could reproduce the problem, the radix sort did not behave correctly when we
ran out of bits, which can happen on 32bit platforms. The attached patch fixes
the problem.

[Bug target/99195] Optimise away vec_concat of 64-bit AdvancedSIMD operations with zeroes in aarch64

2023-05-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99195

--- Comment #12 from CVS Commits  ---
The master branch has been updated by Kyrylo Tkachov :

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

commit r14-653-gc8977cf5f2daa9fecfc5d67a737506d0d31c578a
Author: Kyrylo Tkachov 
Date:   Wed May 10 11:50:01 2023 +0100

aarch64: PR target/99195 annotate simple saturating add/sub patterns for
vec-concat-zero

Moving onto the saturating instructions, this one goes through the simple
add/sub ones.
Bootstrapped and tested on aarch64-none-linux-gnu and aarch64_be-none-elf.

gcc/ChangeLog:

PR target/99195
* config/aarch64/aarch64-simd.md
(aarch64_q):
Rename to...
(aarch64_q): ... This.
(aarch64_qadd): Rename to...
(aarch64_qadd): ... This.

gcc/testsuite/ChangeLog:

PR target/99195
* gcc.target/aarch64/simd/pr99195_1.c: Add testing for qadd, qsub.
* gcc.target/aarch64/simd/pr99195_6.c: New test.

[Bug target/99195] Optimise away vec_concat of 64-bit AdvancedSIMD operations with zeroes in aarch64

2023-05-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99195

--- Comment #11 from CVS Commits  ---
The master branch has been updated by Kyrylo Tkachov :

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

commit r14-651-gd1e7f9993084b87e6676a5ccef3c8b7f807a6013
Author: Kyrylo Tkachov 
Date:   Wed May 10 10:40:06 2023 +0100

aarch64: PR target/99195 annotate simple narrowing patterns for
vec-concat-zero

This patch cleans up some almost-duplicate patterns for the XTN, SQXTN,
UQXTN instructions.
Using the  attributes we can remove the BYTES_BIG_ENDIAN and
!BYTES_BIG_ENDIAN cases,
as well as the intrinsic expanders that select between the two.
Tests are also added. Thankfully the diffstat comes out negative \O/.

Bootstrapped and tested on aarch64-none-linux-gnu and aarch64_be-none-elf.

gcc/ChangeLog:

PR target/99195
* config/aarch64/aarch64-simd.md (aarch64_xtn_insn_le):
Delete.
(aarch64_xtn_insn_be): Likewise.
(trunc2): Rename to...
(trunc2): ... This.
(aarch64_xtn): Move under the above.  Just emit the truncate
RTL.
(aarch64_qmovn): Likewise.
(aarch64_qmovn): New define_insn.
(aarch64_qmovn_insn_le): Delete.
(aarch64_qmovn_insn_be): Likewise.

gcc/testsuite/ChangeLog:

PR target/99195
* gcc.target/aarch64/simd/pr99195_4.c: Add tests for vmovn, vqmovn.

[Bug c++/109756] "internal compiler error: tree check" when using the [[assume]] attribute with pack expansion

2023-05-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109756

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

https://gcc.gnu.org/g:39d6d4256d16d676f8b9031c4d1d115ddf4ad76b

commit r14-650-g39d6d4256d16d676f8b9031c4d1d115ddf4ad76b
Author: Jakub Jelinek 
Date:   Wed May 10 11:37:04 2023 +0200

c++: Reject attributes without arguments used as pack expansion [PR109756]

The following testcase shows we silently accept (and ignore) attributes
without
arguments used as pack expansions.  This is because we call
make_pack_expansion and that starts with
  if (!arg || arg == error_mark_node)
return arg;
Now, an attribute without arguments like [[noreturn...]] is IMHO always
invalid, in this case for 2 reasons; one is that as it has no arguments,
no pack can be present and second is that the standard says that
attributes need to specially permit uses of parameter pack and doesn't
explicitly permit it for any of the standard attributes (except for
alignas?
which has different syntax).
If an attribute has some arguments but doesn't contain packs in those
arguments, make_pack_expansion will already diagnose it.

The patch also changes cp_parser_std_attribute, such that for attributes
unknown
to the compiler (or perhaps registered just for -Wno-attributes=) we
differentiate
between the attribute having no arguments (in that case we want to diagnose
them
when followed by ellipsis even if they are unknown, as they can't contain a
pack
in that case) and the case where they do have arguments but we've just
skipped over
those arguments because we don't know how to parse them (except that they
are
a balanced token sequence) - in that case we really don't know if they
contain
packs or not.

2023-05-10  Jakub Jelinek  

PR c++/109756
* parser.cc (cp_parser_std_attribute): For unknown attributes with
arguments set TREE_VALUE (attribute) to error_mark_node after
skipping
the balanced tokens.
(cp_parser_std_attribute_list): If ... is used after attribute
without
arguments, diagnose it and return error_mark_node.  If
TREE_VALUE (attribute) is error_mark_node, don't call
make_pack_expansion nor return early error_mark_node.

* g++.dg/cpp0x/gen-attrs-78.C: New test.

[Bug target/106708] [rs6000] 64bit constant generation with oris xoris

2023-05-10 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106708

--- Comment #3 from Jiu Fu Guo  ---
With the trunk, for
  *arg++ = 0x98765432ULL;
  *arg++ = 0x7cdeab55ULL;
are expected.

For *arg++ = 0x6543ULL; lis+xoris are not committed to the trunk
yet.

[Bug target/93178] PPC: inefficient 64-bit constant generation if msb is off in low 16 bit

2023-05-10 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93178

Jiu Fu Guo  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
 CC||guojiufu at gcc dot gnu.org

--- Comment #4 from Jiu Fu Guo  ---
On the trunk, the output is expected:
li 3,17185
oris 3,3,0x8765
blr

[Bug target/109773] RISC-V: ICE when build RVV Intrinsic in Both GCC 13 && GCC 14

2023-05-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109773

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Kito Cheng :

https://gcc.gnu.org/g:69f3914414a303f0e2c8246e08925f90c207846c

commit r14-647-g69f3914414a303f0e2c8246e08925f90c207846c
Author: Juzhe-Zhong 
Date:   Tue May 9 10:19:34 2023 +0800

RISC-V: Fix dead loop for user vsetvli intrinsic avl checking [PR109773]

This patch is fix dead loop in vsetvl intrinsic avl checking.

vsetvli->get_def () has vsetvli->get_def () has vsetvli.
Then it will keep looping in the vsetvli avl checking which is a dead loop.

PR target/109773

gcc/ChangeLog:

* config/riscv/riscv-vsetvl.cc (avl_source_has_vsetvl_p): New
function.
(source_equal_p): Fix dead loop in vsetvl avl checking.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/vsetvl/pr109773-1.c: New test.
* gcc.target/riscv/rvv/vsetvl/pr109773-2.c: New test.

[Bug tree-optimization/109791] -Wstringop-overflow warning with -O3 and _GLIBCXX_USE_CXX11_ABI=0

2023-05-10 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109791

Richard Biener  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 CC||aldyh at gcc dot gnu.org,
   ||amacleod at redhat dot com,
   ||rguenth at gcc dot gnu.org
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2023-05-10

--- Comment #2 from Richard Biener  ---
Confirmed.  This is a missed optimization, we fail to optimize the loop guard

 [local count: 329643239]:
_4 = (unsigned long)   [(void *) + 2B];
_6 = (unsigned long) __i_14;
_50 = -_6;
_100 = _4 + 18446744073709551615;
_40 = _100 - _6;
_41 = _40 > 13;
if (_41 != 0)

with __i_14 being

 [local count: 452186132]:
# __i_14 = PHI <  [(void *) + 1B](10),   [(void
*) + 2B](9)>

I'll note that the strlen pass runs before VRP (but after DOM), but I'll
also note that likely ranger isn't very good with these kind of
"symbolic" ranges?  How would we handle this?  Using two
relations, __i_14 >=  + 1 && __i_14 <=  + 2?

DOM has

Optimizing block #16

1>>> STMT 1 =   [(void *) + 2B] ge_expr __i_14
1>>> STMT 1 =   [(void *) + 2B] ne_expr __i_14
1>>> STMT 0 =   [(void *) + 2B] eq_expr __i_14
1>>> STMT 1 =   [(void *) + 2B] gt_expr __i_14
1>>> STMT 0 =   [(void *) + 2B] le_expr __i_14
Optimizing statement _4 = (unsigned long)   [(void *) + 2B];
LKUP STMT _4 = nop_expr   [(void *) + 2B]
2>>> STMT _4 = nop_expr   [(void *) + 2B]
Optimizing statement _6 = (unsigned long) __i_14;
LKUP STMT _6 = nop_expr __i_14
2>>> STMT _6 = nop_expr __i_14
Optimizing statement _50 = -_6;
 Registering value_relation (_6 pe64 __i_14) (bb16) at _6 = (unsigned long)
__i_14;
LKUP STMT _50 = negate_expr _6
2>>> STMT _50 = negate_expr _6
Optimizing statement _100 = _4 + 18446744073709551615;
LKUP STMT _100 = _4 plus_expr 18446744073709551615
2>>> STMT _100 = _4 plus_expr 18446744073709551615
Optimizing statement _40 = _100 - _6;
 Registering value_relation (_100 < _4) (bb16) at _100 = _4 +
18446744073709551615;
LKUP STMT _40 = _100 minus_expr _6
2>>> STMT _40 = _100 minus_expr _6
Optimizing statement _41 = _40 > 13;
LKUP STMT _41 = _40 gt_expr 13
2>>> STMT _41 = _40 gt_expr 13
LKUP STMT _40 le_expr 14
Optimizing statement if (_41 != 0)

Visiting conditional with predicate: if (_41 != 0)

With known ranges
_41: [irange] bool VARYING

[Bug c++/109790] [11/12/13/14 Regression] internal compiler error in write_member_name, at cp/mangle.cc:2992

2023-05-10 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109790

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug fortran/109788] [14 Regression] gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int since r14-377-gc92b8be9b52b7e

2023-05-10 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109788

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |14.0
Version|13.0|14.0

[Bug testsuite/109793] new test case gcc.dg/vect/pr108950.c from r11-10752-gd4cbcb9e45c6d4 fails

2023-05-10 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109793

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #2 from Richard Biener  ---
Fixed - sorry.

[Bug testsuite/108985] new test case gcc.dg/vect/pr108950.c from r13-6384-ge3837b6f6c28a1 fails

2023-05-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108985

--- Comment #4 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Richard Biener
:

https://gcc.gnu.org/g:531d5439021fb6402cf3f8606b9d9e13f9d03e5a

commit r11-10756-g531d5439021fb6402cf3f8606b9d9e13f9d03e5a
Author: Richard Biener 
Date:   Thu Mar 2 09:03:37 2023 +0100

testsuite/108985 - missing vect_simd_clones target requirement on test

Added.

PR testsuite/108985
* gcc.dg/vect/pr108950.c: Require vect_simd_clones.

(cherry picked from commit a2926653ebbc88e8bba335563fa86b44651598d6)

[Bug tree-optimization/109695] [14 Regression] crash in gimple_ranger::range_of_expr since r14-377-gc92b8be9b52b7e

2023-05-10 Thread rguenther at suse dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109695

--- Comment #32 from rguenther at suse dot de  ---
On Tue, 9 May 2023, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109695
> 
> --- Comment #29 from Jakub Jelinek  ---
> Comment on attachment 55031
>   --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55031
> WIP patch for a dynamic int_range<>
> 
> What I meant is that by using a auto_vec could avoid reimplementing larger
> chunks of vec.h/vec.cc for this.
> Resizing by adding 10 more ranges can have higher compile time cost than what
> vec.cc (calculate_allocation_1) does - doubles the size each time for smaller
> sizes and and multiplying previous by 3 / 2 for larger ones.

If we still have a hard limit on the MAX number of ranges (previosly 255)
then I'd probably go straight from stack -> that MAX and never re-allocate
further?