[Bug c++/104507] [10/11 Regression] internal compiler error: unexpected expression ‘(int)(__ret)’ of kind cast_expr

2022-02-13 Thread junk at sigpwr dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104507

--- Comment #2 from Daniel Nelson  ---
Had a few moments to do some testing/bisecting, and found the commit that fixed
this in mainline.

commit 9927ecbb42d5be48fa933adc26f8601fab5007ca
Author: Patrick Palka 
Date:   Thu Oct 28 10:05:14 2021 -0400

c++: quadratic constexpr behavior for left-assoc logical exprs [PR102780]

In the testcase below the two left fold expressions each expand into a
constant logical expression with 1024 terms, for which potential_const_expr
takes more than a minute to return true.  This happens because p_c_e_1
performs trial evaluation of the first operand of a &&/|| in order to
determine whether to consider the potentiality of the second operand.
And because the expanded expression is left-associated, this trial
evaluation causes p_c_e_1 to be quadratic in the number of terms of the
expression.

This patch fixes this quadratic behavior by making p_c_e_1 preemptively
compute potentiality of the second operand of a &&/||, and perform trial
evaluation of the first operand only if the second operand isn't
potentially constant.  We must be careful to avoid emitting bogus
diagnostics during the preemptive computation; to that end, we perform
this shortcut only when tf_error is cleared, and when tf_error is set we
now first check potentiality of the whole expression quietly and replay
the check noisily for diagnostics.

Apart from fixing the quadraticness for left-associated logical exprs,
this change also reduces compile time for the libstdc++ testcase
20_util/variant/87619.cc by about 15% even though our  uses
right folds instead of left folds.  Likewise for the testcase in the PR,
for which compile time is reduced by 30%.  The reason for these speedups
is that p_c_e_1 no longer performs expensive trial evaluation of each term
of large constant logical expressions when determining their potentiality.

PR c++/102780

gcc/cp/ChangeLog:

* constexpr.c (potential_constant_expression_1) :
When tf_error isn't set, preemptively check potentiality of the
second operand before performing trial evaluation of the first
operand.
(potential_constant_expression_1): When tf_error is set, first
check
potentiality quietly and return true if successful, otherwise
proceed noisily to give errors.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/fold13.C: New test.

 gcc/cp/constexpr.c  | 26 +-
 gcc/testsuite/g++.dg/cpp1z/fold13.C | 29 +
 2 files changed, 50 insertions(+), 5 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp1z/fold13.C

[Bug sanitizer/104518] New: ICE: verify_gimple failed: missing 'PHI' def with -fsanitize=address -fnon-call-exceptions -fsignaling-nans -fharden-compares -fstack-check=generic

2022-02-13 Thread zsojka at seznam dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104518

Bug ID: 104518
   Summary: ICE: verify_gimple failed: missing 'PHI' def with
-fsanitize=address -fnon-call-exceptions
-fsignaling-nans -fharden-compares
-fstack-check=generic
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zsojka at seznam dot cz
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---
  Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu

Created attachment 52431
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52431&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -fsanitize=address -fnon-call-exceptions
-fsignaling-nans -fharden-compares -fstack-check=generic testcase.c
testcase.c: In function 'foo':
testcase.c:7:1: error: missing 'PHI' def
7 | foo (void)
  | ^~~
last_alloca_addr.5_54 = PHI 
during GIMPLE pass: hardcmp
testcase.c:7:1: internal compiler error: verify_gimple failed
0x13e400a verify_gimple_in_cfg(function*, bool)
/repo/gcc-trunk/gcc/tree-cfg.cc:5561
0x128a437 execute_function_todo
/repo/gcc-trunk/gcc/passes.cc:2084
0x128a9db execute_todo
/repo/gcc-trunk/gcc/passes.cc:2138
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.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-7214-20220212191744-gf0c7367b880-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r12-7214-20220212191744-gf0c7367b880-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.1 20220212 (experimental) (GCC)

[Bug tree-optimization/104518] ICE: verify_gimple failed: missing 'PHI' def with -fsanitize=address -fnon-call-exceptions -fsignaling-nans -fharden-compares -fstack-check=generic

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104518

Andrew Pinski  changed:

   What|Removed |Added

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

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

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

[Bug tree-optimization/103856] ICE during GIMPLE pass: hardcmp since r12-4759-g95bb87b2458bfab4 and -fnon-call-exceptions -fsignaling-nans

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103856

Andrew Pinski  changed:

   What|Removed |Added

 CC||zsojka at seznam dot cz

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

[Bug target/79754] ICE in type_natural_mode with vector for DFP type

2022-02-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79754

--- Comment #6 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Uros Bizjak :

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

commit r11-9564-ge89144e8a3984608da2d31f18776df51d9e0f352
Author: Uros Bizjak 
Date:   Sat Feb 12 10:53:49 2022 +0100

i386: Skip decimal float vector modes in type_natural_mode [PR79754]

2022-02-12  Uroš Bizjak  

gcc/ChangeLog:

PR target/79754
* config/i386/i386.c (type_natural_mode):
Skip decimal float vector modes.

gcc/testsuite/ChangeLog:

PR target/79754
* gcc.target/i386/pr79754.c: New test.

(cherry picked from commit edadc7e0510b703d9727cf5ff68d55d84bb95def)

[Bug target/103771] [12 Regression] Missed vectorization under -mavx512f -mavx512vl after r12-5489

2022-02-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771

--- Comment #36 from CVS Commits  ---
The master branch has been updated by hongtao Liu :

https://gcc.gnu.org/g:7e204bd2f189850cb940677c99d8d93eb7dd40cd

commit r12-7216-g7e204bd2f189850cb940677c99d8d93eb7dd40cd
Author: liuhongt 
Date:   Mon Jan 24 11:05:47 2022 +0800

Add vect_recog_cond_expr_convert_pattern.

The pattern converts (cond (cmp a b) (convert c) (convert d))
to (convert (cond (cmp a b) c d)) when
1) types_match (c, d)
2) single_use for (convert c) and (convert d)
3) TYPE_PRECISION (TREE_TYPE (c)) == TYPE_PRECISION (TREE_TYPE (a))
4) INTEGERAL_TYPE_P (TREE_TYPE (c))

The pattern can save packing of mask and data(partial for data, 2 vs
1).

gcc/ChangeLog:

PR target/103771
* match.pd (cond_expr_convert_p): New match.
* tree-vect-patterns.cc (gimple_cond_expr_convert_p): Declare.
(vect_recog_cond_expr_convert_pattern): New.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr103771-2.c: New test.
* gcc.target/i386/pr103771-3.c: New test.

[Bug target/79754] ICE in type_natural_mode with vector for DFP type

2022-02-13 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79754

Uroš Bizjak  changed:

   What|Removed |Added

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

--- Comment #7 from Uroš Bizjak  ---
Fixed for 11.3+.

[Bug c++/104514] add feature to create a pointer to a fixed address as constexpr

2022-02-13 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104514

--- Comment #1 from Jonathan Wakely  ---
This is forbidden by C++, but I've started writing a proposal for a language
feature to support this use case

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

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

Johel Ernesto Guerrero Peña  changed:

   What|Removed |Added

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

--- Comment #5 from Johel Ernesto Guerrero Peña  ---
Fixed somewhere along the way.

[Bug c++/99227] [meta] [modules] Bugs relating to header-units of STL header files

2022-02-13 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99227
Bug 99227 depends on bug 103118, which changed state.

Bug 103118 Summary: [modules] ICE tree check in get_merge_kind at cp/module.cc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103118

   What|Removed |Added

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

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

2022-02-13 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
Bug 103524 depends on bug 103118, which changed state.

Bug 103118 Summary: [modules] ICE tree check in get_merge_kind at cp/module.cc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103118

   What|Removed |Added

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

[Bug c++/103468] [modules] ICE Segmentation fault during GIMPLE pass walloca

2022-02-13 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103468

Johel Ernesto Guerrero Peña  changed:

   What|Removed |Added

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

--- Comment #1 from Johel Ernesto Guerrero Peña  ---
Fixed somewhere along the way.

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

2022-02-13 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
Bug 103524 depends on bug 103468, which changed state.

Bug 103468 Summary: [modules] ICE Segmentation fault during GIMPLE pass walloca
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103468

   What|Removed |Added

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

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

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

--- Comment #5 from Johel Ernesto Guerrero Peña  ---
This was fixed somewhere along the way.

[Bug c++/103468] [modules] ICE Segmentation fault during GIMPLE pass walloca

2022-02-13 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103468

Johel Ernesto Guerrero Peña  changed:

   What|Removed |Added

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

--- Comment #2 from Johel Ernesto Guerrero Peña  ---
No. Turns out I just used my system's GCC 11, which seems to not suffer from
the bug. It's still present in trunk.

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

2022-02-13 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
Bug 103524 depends on bug 103468, which changed state.

Bug 103468 Summary: [modules] ICE Segmentation fault during GIMPLE pass walloca
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103468

   What|Removed |Added

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

[Bug fortran/104228] [9/10/11/12 Regression] ICE in df_install_ref, at df-scan.cc:2294 since r8-3589-g707905d0773e5a8e

2022-02-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104228

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Mikael Morin :

https://gcc.gnu.org/g:57da34939703a6e6d3267a0d25d1fb9369d3ac0e

commit r12-7217-g57da34939703a6e6d3267a0d25d1fb9369d3ac0e
Author: Mikael Morin 
Date:   Fri Jan 28 22:00:57 2022 +0100

fortran: Unshare associate var charlen [PR104228]

PR104228 showed that character lengths were shared between associate
variable and associate targets.  This is problematic when the associate
target is itself a variable and gets a variable to hold the length, as
the length variable is added (and all the variables following it in the
chain)
to both the associate variable scope and the target variable scope.
This caused an ICE when compiling with -O0 -fsanitize=address.

This change forces the creation of a separate character length for the
associate variable.  It also forces the initialization of the character
length variable to avoid regressing associate_32 and associate_47 tests.

PR fortran/104228

gcc/fortran/ChangeLog:

* resolve.cc (resolve_assoc_var): Also create a new character
length for non-dummy associate targets.
* trans-stmt.cc (trans_associate_var): Initialize character length
even if no temporary is used for the associate variable.

gcc/testsuite/ChangeLog:

* gfortran.dg/asan/associate_58.f90: New test.
* gfortran.dg/asan/associate_59.f90: New test.

[Bug tree-optimization/104519] New: wrong code at -Os on x86_64-linux-gnu

2022-02-13 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104519

Bug ID: 104519
   Summary: wrong code at -Os on x86_64-linux-gnu
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

This appears to be a recent regression.

[682] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220213 (experimental) [master r12-7216-g7e204bd2f18] (GCC) 
[683] % 
[683] % gcctk -O1 small.c; ./a.out
[684] % 
[684] % gcctk -Os small.c
[685] % ./a.out
Aborted
[686] % 
[686] % cat small.c
char a, b;
int main() {
  for (b = -7; b; b += 3)
if (a)
  __builtin_abort();
  return 0;
}

[Bug tree-optimization/104519] wrong code at -Os on x86_64-linux-gnu

2022-02-13 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104519

--- Comment #1 from Zhendong Su  ---
>From Compiler Explorer: https://godbolt.org/z/s7Eco5EGb

[Bug fortran/104520] New: Unexpected behavior with STORAGE_SIZE intrinsic with a dummy argument that is unlimited polymorphic

2022-02-13 Thread fortranfan at outlook dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104520

Bug ID: 104520
   Summary: Unexpected behavior with STORAGE_SIZE intrinsic with a
dummy argument that is unlimited polymorphic
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fortranfan at outlook dot com
  Target Milestone: ---

Consider the following:

--- begin code ---
module m
   use, intrinsic :: iso_fortran_env, only : character_storage_size
contains
   subroutine sub( a )
  class(*), intent(in) :: a
  print *, "storage_size(s) = ", storage_size(a)
  select type ( a )
 type is ( character(len=*) )
print *, "expected is ", len(a)*character_storage_size
  end select
   end subroutine 
end module
   use m 
   character(len=2) :: s
   call sub( s )
end
--- end code ---

And the program behavior using gfortran:
--- begin console output ---
C:\temp>gfortran -Wall y.f90 -o y.exe

C:\temp>y.exe
 storage_size(s) =8
 expected is   16

C:\temp>
--- end output ---

On the other hand, consider the following:

--- begin code ---
   character(len=2) :: s
   print *, storage_size(s)
end
--- end code ---

The program behavior is

--- begin output ---
C:\temp>gfortran -Wall y.f90 -o y.exe

C:\temp>y.exe
  16

C:\temp>
--- end output ---

I failed to find anything in the Fortran standard that supports the above shown
program behavior.  Can the first case with the unlimited polymorphic dummy be
expected to the same as the second, meaning the storage size of the object get
determined as 16 bits?

Thank you,
Vipul Parekh

[Bug tree-optimization/104521] New: wrong code at -O2 and -O3 on x86_64-linux-gnu

2022-02-13 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104521

Bug ID: 104521
   Summary: wrong code at -O2 and -O3 on x86_64-linux-gnu
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

It appears to be a recent regression and is very likely related to PR 104519.
But opposite to PR 104519, it doesn't reproduce at -Os, and instead reproduces
at -O2 and -O3. At -Os, there is a spurious UB warning though.

[611] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220213 (experimental) [master r12-7216-g7e204bd2f18] (GCC) 
[612] % 
[612] % gcctk -Os small.c; ./a.out
small.c: In function ‘main’:
small.c:6:30: warning: iteration 42 invokes undefined behavior
[-Waggressive-loop-optimizations]
6 |   for (c = 0; c != -4; c -= 3) {
  |  ^~
small.c:6:21: note: within this loop
6 |   for (c = 0; c != -4; c -= 3) {
  |   ~~^
[613] % 
[613] % gcctk -O2 small.c
[614] % timeout -s 9 5 ./a.out
Killed
[615] % 
[615] % cat small.c
char a, b, c;
int main() {
  unsigned char d = 1;
  while (1) {
if (c >= a) {
  for (c = 0; c != -4; c -= 3) {
while (!d)
  b = 0;
continue;
  }
}
d = ~a;
if (!d)
  continue;
return 0;
  }
}

[Bug tree-optimization/104521] wrong code at -O2 and -O3 on x86_64-linux-gnu

2022-02-13 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104521

--- Comment #1 from Zhendong Su  ---
>From Compiler Explorer: https://godbolt.org/z/Y37Wo9e8c

[Bug rtl-optimization/104153] [12 Regression] ICE due to recent ifcvt changes

2022-02-13 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104153

Jeffrey A. Law  changed:

   What|Removed |Added

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

--- Comment #11 from Jeffrey A. Law  ---
Fixed on the trunk.

[Bug rtl-optimization/104154] [12 Regression] Another ICE due to recent ifcvt changes

2022-02-13 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104154

--- Comment #5 from Jeffrey A. Law  ---
Created attachment 52432
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52432&action=edit
Testcase #2

[Bug rtl-optimization/104154] [12 Regression] Another ICE due to recent ifcvt changes

2022-02-13 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104154

Jeffrey A. Law  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2022-02-13

--- Comment #6 from Jeffrey A. Law  ---
So the patch gets the first testcase working, but we fail shortly thereafter in
a similar way on another testcase.Compile with -O2 using an arc-elf cross
compiler.

[Bug rtl-optimization/104522] New: ICE: in real_to_decimal_for_mode, at real.cc:1770 with -O -fcompare-debug

2022-02-13 Thread zsojka at seznam dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104522

Bug ID: 104522
   Summary: ICE: in real_to_decimal_for_mode, at real.cc:1770 with
-O -fcompare-debug
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zsojka at seznam dot cz
  Target Milestone: ---
  Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu

Created attachment 52433
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52433&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O -fcompare-debug testcase.c
during RTL pass: *clean_state
testcase.c: In function 'foo':
testcase.c:10:1: internal compiler error: in real_to_decimal_for_mode, at
real.cc:1770
   10 | }
  | ^
0x75757a real_to_decimal_for_mode(char*, real_value const*, unsigned long,
unsigned long, int, machine_mode)
/repo/gcc-trunk/gcc/real.cc:1770
0x12bd744 rtx_writer::print_rtx(rtx_def const*)
/repo/gcc-trunk/gcc/print-rtl.cc:981
0x12be1a2 rtx_writer::print_rtx_operand_code_e(rtx_def const*, int)
/repo/gcc-trunk/gcc/print-rtl.cc:359
0x12bd34f rtx_writer::print_rtx(rtx_def const*)
/repo/gcc-trunk/gcc/print-rtl.cc:938
0x12be1a2 rtx_writer::print_rtx_operand_code_e(rtx_def const*, int)
/repo/gcc-trunk/gcc/print-rtl.cc:359
0x12bd34f rtx_writer::print_rtx(rtx_def const*)
/repo/gcc-trunk/gcc/print-rtl.cc:938
0x12bf340 rtx_writer::print_rtl_single_with_indent(rtx_def const*, int)
/repo/gcc-trunk/gcc/print-rtl.cc:1245
0x12bf39f print_rtl_single(_IO_FILE*, rtx_def const*)
/repo/gcc-trunk/gcc/print-rtl.cc:1228
0xfc2a36 rest_of_clean_state
/repo/gcc-trunk/gcc/final.cc:4494
0xfc2a36 execute
/repo/gcc-trunk/gcc/final.cc:4584
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-7217-20220213164646-g57da3493970-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r12-7217-20220213164646-g57da3493970-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.1 20220213 (experimental) (GCC)

[Bug target/104117] [9,10,11,12 Regression] Darwin ppc64 uses invalid non-PIC address to access constants (in PIC code).

2022-02-13 Thread iains at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104117

--- Comment #24 from Iain Sandoe  ---
(In reply to Sergey Fedorov from comment #22)
> (In reply to Iain Sandoe from comment #20)
> > On testing, this is not sufficient - one ends up with ICEs when we reject a
> > valid (UNSPEC-wrapped) address here.  So I think that the slightly more
> > elaborate target changes are required - but the LRA change seems fine!
> > ... reg-straps on this old h/w take > 1 day .. so some more time will be
> > needed for a complete answer.
> 
> Once you decide the patch is ready for testing, please let me know, I will
> test it on my end too (for icu and R both).

The patch applied to master will be backported (when I have some time!) .. but
it should apply reasonably easily to 11.2 / 10.3 if you are keen to try it out.

[Bug target/103008] poor inlined builtin_fmod on x86_64

2022-02-13 Thread Dave.Love at manchester dot ac.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103008

--- Comment #15 from Dave.Love at manchester dot ac.uk ---
"ubizjak at gmail dot com"  writes:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103008
>
> --- Comment #14 from Uroš Bizjak  ---
> Created attachment 52428
>   --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52428&action=edit
> Proposed patch
>
> The attached patch implements:
>
> fmod (a, p) = a - trunc (a/p) * p
> drem (a, p) = a - roundeven (a/p) * p
>
> using SSE4 round instruction (and uses fnma when available).
>
> Timings with Polyhedron ac.f90 on IvyBridge-E, Fedora-34, glibc 2.33-21.fc34
>
> -Ofast:
>6,150082000 seconds user
>
> -Ofast -mno-80387:
>   18,354654000 seconds user
>
> -Ofast -msse4:
>5,722511000 seconds user

I realize I never made a Fortran bug report about this, and should do.
(I think the gfortran intrinsic should avoid fmod anyway, and just use
the standard's arithmetical definition of MOD without having to bother
about errors.)

[Bug middle-end/104522] ICE: in real_to_decimal_for_mode, at real.cc:1770 with -O -fcompare-debug

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104522

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2022-02-13
 Ever confirmed|0   |1
  Component|rtl-optimization|middle-end
 Status|UNCONFIRMED |NEW

--- Comment #1 from Andrew Pinski  ---
Here is a simplier testcase:
typedef short __attribute__((__vector_size__(16))) V;

_Float64x t1;

void
foo(void)
{
  V t={1024>>1, 0, 0, 0, 32768>>1};
  _Float64x tt = *(_Float64x*)&t;
  t1 /= tt;
}

This ICEs at -O1 -fdump-tree-all-details during forwprop1.

[Bug middle-end/104522] ICE: in real_to_decimal_for_mode with -O -fdump-tree-all-details and long double

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104522

Andrew Pinski  changed:

   What|Removed |Added

Summary|ICE: in |ICE: in
   |real_to_decimal_for_mode|real_to_decimal_for_mode
   |with -O |with -O
   |-fdump-tree-all-details and |-fdump-tree-all-details and
   |_Float64x   |long double
  Known to fail||4.4.7

--- Comment #2 from Andrew Pinski  ---
Here is a better testcase which shows the issue all the way back to at least
4.4.7:
typedef short __attribute__((__vector_size__(16))) V;

long double t1;

void
foo(void)
{
  V t={1024>>1, 0, 0, 0, 32768>>1};
  long double tt = *(long double*)&t;
  t1 /= tt;
}

[Bug tree-optimization/104521] [12 Regression] wrong code at -O2 and -O3 with char as loop induction variable

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104521

Andrew Pinski  changed:

   What|Removed |Added

Summary|wrong code at -O2 and -O3   |[12 Regression] wrong code
   |on x86_64-linux-gnu |at -O2 and -O3 with char as
   ||loop induction variable
   Target Milestone|--- |12.0
  Known to work||11.2.0
  Known to fail||12.0
   Keywords||diagnostic, wrong-code

--- Comment #2 from Andrew Pinski  ---
I suspect it was introduced by r12-6844-gf1af8528d3 .

[Bug tree-optimization/104519] [12 Regression] wrong code at -Os on x86_64-linux-gnu

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104519

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |12.0
   Keywords||wrong-code
Summary|wrong code at -Os on|[12 Regression] wrong code
   |x86_64-linux-gnu|at -Os on x86_64-linux-gnu

[Bug tree-optimization/104521] [12 Regression] wrong code at -O2 and -O3 with char as loop induction variable

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104521

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
Dup of bug 104519.

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

[Bug tree-optimization/104519] [12 Regression] wrong code at -Os on x86_64-linux-gnu

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104519

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

[Bug tree-optimization/104519] [12 Regression] wrong code at -Os on x86_64-linux-gnu and char as induction variable

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104519

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
Summary|[12 Regression] wrong code  |[12 Regression] wrong code
   |at -Os on x86_64-linux-gnu  |at -Os on x86_64-linux-gnu
   ||and char as induction
   ||variable
   Last reconfirmed||2022-02-13

--- Comment #3 from Andrew Pinski  ---
I suspect it was introduced by r12-6844-gf1af8528d3 .


Confirmed.

[Bug c++/104514] add feature to create a pointer to a fixed address as constexpr

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104514

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2022-02-13
 Status|UNCONFIRMED |NEW

--- Comment #2 from Andrew Pinski  ---
I thought there was another bug open asking for this same thing but I can't
find it right now.

[Bug c++/104523] New: G++ crash when compiling a simple module that includes pybind11/stl.h

2022-02-13 Thread juanjo at juanjoalvarez dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104523

Bug ID: 104523
   Summary: G++ crash when compiling a simple module that includes
pybind11/stl.h
   Product: gcc
   Version: 11.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: juanjo at juanjoalvarez dot net
  Target Milestone: ---

// Info
Version of GCC: gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
System type; Ubuntu 21.10 AMD64.

// Steps to reproduce

I have a very simple to reproduce segmentation fault on the compiler when using
C++20 modules.

Steps to reproduce:

1. Install PyBind11 header files (it's a header only lib). If you have Python
the simplest way to do it is to "pip install pybind11". Then get the include
path, it usually will be at (python site-packages dir)/pybind11/include.

2. Install Python development header files (usually called pythonx.y-dev on
most distros).

3. Compile the file below with (update the include paths):

c++ -std=c++20 -fmodules-ts \
  -I/home/juanjux/.local/lib/python3.9/site-packages/pybind11/include \
  -I/home/juanjux/.pyenv/versions/3.9.7/include/python3.9 \
  -c -o build/PyBind11Module.o PyBind11Module.cpp



// File PyBind11Module.cpp start -->

module;
#include 
export module PyBind11Module;

// <--- File end

Result on my system:

PyBind11Module.cpp:5:9: internal compiler error: Segmentation fault
5 | export module PyBind11Module;
  | ^~
0xb0c67e crash_signal
../../src/gcc/toplev.c:327
0x7f517144d51f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x9ca50d node_template_info
../../src/gcc/cp/module.cc:3895
0x9f0f5d get_originating_module_decl(tree_node*)
../../src/gcc/cp/module.cc:18327
0x9ded59 trees_out::decl_value(tree_node*, depset*)
../../src/gcc/cp/module.cc:7523
0x9df5c9 trees_out::decl_node(tree_node*, walk_kind)
../../src/gcc/cp/module.cc:8247
0x9e012a trees_out::tree_node(tree_node*)
../../src/gcc/cp/module.cc:9085
0x9ead9a module_state::write_cluster(elf_out*, depset**, unsigned int,
depset::hash&, unsigned int*, unsigned int*)
../../src/gcc/cp/module.cc:14633
0xa08f7a module_state::write(elf_out*, cpp_reader*)
../../src/gcc/cp/module.cc:17736
0x638d8a finish_module_processing(cpp_reader*)
../../src/gcc/cp/module.cc:19859
0xfa265e c_parse_final_cleanups()
../../src/gcc/cp/decl2.c:5175
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c++/104523] G++ crash when compiling a simple module that includes pybind11/stl.h

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104523

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2022-02-13
 Ever confirmed|0   |1
 Status|UNCONFIRMED |WAITING

--- Comment #1 from Andrew Pinski  ---
Can you please add -save-temps and attach the resulting .ii file too?
Or add -freport-bug and attach the file mentioned in the error message.
Compressing the file is fine too.

[Bug ada/98724] [11/12 Regression] gnat build failure on alpha-linux-gnu

2022-02-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98724

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Maciej W. Rozycki :

https://gcc.gnu.org/g:4493c5a2030d9191761d159067815b5f0325a9d2

commit r12-7220-g4493c5a2030d9191761d159067815b5f0325a9d2
Author: Maciej W. Rozycki 
Date:   Sun Feb 13 22:57:21 2022 +

[Ada] PR ada/98724: Alpha/Linux/libada: Use wraplf for Aux_Long_Long_Float

Use the Long Long Float wrapper in terms of Long Float for Alpha/Linux
targets as well, fixing gnatlib compilation errors:

a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on result
[enabledby default]
a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on parameter 1
[enabled by default]
a-nallfl.ads:48:13: warning: profile of "Sin" doesn't match the builtin it
binds [enabled by default]

etc. with the `alpha-linux-gnu' target.

gcc/ada/
PR ada/98724
PR ada/97504
* Makefile.rtl (LIBGNAT_TARGET_PAIRS) : Use
wraplf version of Aux_Long_Long_Float.

[Bug ada/97504] [11 Regression] Ada bootstrap error after r11-4029

2022-02-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97504

--- Comment #47 from CVS Commits  ---
The master branch has been updated by Maciej W. Rozycki :

https://gcc.gnu.org/g:4493c5a2030d9191761d159067815b5f0325a9d2

commit r12-7220-g4493c5a2030d9191761d159067815b5f0325a9d2
Author: Maciej W. Rozycki 
Date:   Sun Feb 13 22:57:21 2022 +

[Ada] PR ada/98724: Alpha/Linux/libada: Use wraplf for Aux_Long_Long_Float

Use the Long Long Float wrapper in terms of Long Float for Alpha/Linux
targets as well, fixing gnatlib compilation errors:

a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on result
[enabledby default]
a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on parameter 1
[enabled by default]
a-nallfl.ads:48:13: warning: profile of "Sin" doesn't match the builtin it
binds [enabled by default]

etc. with the `alpha-linux-gnu' target.

gcc/ada/
PR ada/98724
PR ada/97504
* Makefile.rtl (LIBGNAT_TARGET_PAIRS) : Use
wraplf version of Aux_Long_Long_Float.

[Bug ada/98724] [11/12 Regression] gnat build failure on alpha-linux-gnu

2022-02-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98724

--- Comment #6 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Maciej W. Rozycki
:

https://gcc.gnu.org/g:72b0526bd4582338228ab81088b73dbf1ca565ee

commit r11-9565-g72b0526bd4582338228ab81088b73dbf1ca565ee
Author: Maciej W. Rozycki 
Date:   Sun Feb 13 22:57:21 2022 +

[Ada] PR ada/98724: Alpha/Linux/libada: Use wraplf for Aux_Long_Long_Float

Use the Long Long Float wrapper in terms of Long Float for Alpha/Linux
targets as well, fixing gnatlib compilation errors:

a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on result
[enabledby default]
a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on parameter 1
[enabled by default]
a-nallfl.ads:48:13: warning: profile of "Sin" doesn't match the builtin it
binds [enabled by default]

etc. with the `alpha-linux-gnu' target.

gcc/ada/
PR ada/98724
PR ada/97504
* Makefile.rtl (LIBGNAT_TARGET_PAIRS) : Use
wraplf version of Aux_Long_Long_Float.

(cherry picked from commit 4493c5a2030d9191761d159067815b5f0325a9d2)

[Bug ada/97504] [11 Regression] Ada bootstrap error after r11-4029

2022-02-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97504

--- Comment #48 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Maciej W. Rozycki
:

https://gcc.gnu.org/g:72b0526bd4582338228ab81088b73dbf1ca565ee

commit r11-9565-g72b0526bd4582338228ab81088b73dbf1ca565ee
Author: Maciej W. Rozycki 
Date:   Sun Feb 13 22:57:21 2022 +

[Ada] PR ada/98724: Alpha/Linux/libada: Use wraplf for Aux_Long_Long_Float

Use the Long Long Float wrapper in terms of Long Float for Alpha/Linux
targets as well, fixing gnatlib compilation errors:

a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on result
[enabledby default]
a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on parameter 1
[enabled by default]
a-nallfl.ads:48:13: warning: profile of "Sin" doesn't match the builtin it
binds [enabled by default]

etc. with the `alpha-linux-gnu' target.

gcc/ada/
PR ada/98724
PR ada/97504
* Makefile.rtl (LIBGNAT_TARGET_PAIRS) : Use
wraplf version of Aux_Long_Long_Float.

(cherry picked from commit 4493c5a2030d9191761d159067815b5f0325a9d2)

[Bug c++/104507] [10/11 Regression] internal compiler error: unexpected expression ‘(int)(__ret)’ of kind cast_expr

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104507

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=102780
 CC||ppalka at gcc dot gnu.org
   Keywords|needs-bisection |

--- Comment #3 from Andrew Pinski  ---
(In reply to Daniel Nelson from comment #2)
> Had a few moments to do some testing/bisecting, and found the commit that
> fixed this in mainline.

I kinda of see how that might help here but not really. I wonder if there is
another testcase which might shows the issue on the trunk still.

[Bug ada/98724] [11/12 Regression] gnat build failure on alpha-linux-gnu

2022-02-13 Thread macro at orcam dot me.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98724

Maciej W. Rozycki  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE
 CC||macro at orcam dot me.uk

--- Comment #7 from Maciej W. Rozycki  ---
Fixed; also duplicate of PR ada/97504.

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

[Bug ada/97504] [11 Regression] Ada bootstrap error after r11-4029

2022-02-13 Thread macro at orcam dot me.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97504

--- Comment #49 from Maciej W. Rozycki  ---
*** Bug 98724 has been marked as a duplicate of this bug. ***

[Bug debug/104517] '-fcompare-debug' failure w/ -O1 -fopenmp -fno-tree-ter

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104517

--- Comment #2 from Andrew Pinski  ---
I can't reproduce it on the trunk.

I wonder if it was fixed by the patch which fixed PR 104459.

[Bug debug/104517] '-fcompare-debug' failure w/ -O1 -fopenmp -fno-tree-ter

2022-02-13 Thread asolokha at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104517

--- Comment #3 from Arseny Solokha  ---
No, it still fails w/ 20220213 snapshot
(g:58aeb75d4097010ad9bb72b964265b18ab284f93). You should try adding -save-temps
to the command line.

[Bug c++/104523] G++ crash when compiling a simple module that includes pybind11/stl.h

2022-02-13 Thread juanjo at juanjoalvarez dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104523

--- Comment #2 from Juanjo Alvarez  ---
Created attachment 52434
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52434&action=edit
.ii file

[Bug debug/104517] '-fcompare-debug' failure w/ -O1 -fopenmp -fno-tree-ter

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104517

--- Comment #4 from Andrew Pinski  ---
yes adding -save-temps causes the difference, interesting.

[Bug c++/104523] G++ crash when compiling a simple module that includes pybind11/stl.h

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104523

Andrew Pinski  changed:

   What|Removed |Added

 Status|WAITING |UNCONFIRMED
 Ever confirmed|1   |0

[Bug c++/104523] G++ crash when compiling a simple module that includes pybind11/stl.h

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104523

--- Comment #3 from Andrew Pinski  ---
apinski@xeond:~/src/upstream-gcc$ ~/upstream-gcc/bin/gcc  t.ii -std=c++20
-fmodules-ts
PyBind11Module.cpp:5:9: internal compiler error: tree check: expected none of
template_decl, have template_decl in add_specializations, at cp/module.cc:12971
0x8f8f58 tree_not_check_failed(tree_node const*, char const*, int, char const*,
...)
/home/apinski/src/upstream-gcc/gcc/gcc/tree.c:8739
0x75c6b1 tree_not_check(tree_node*, char const*, int, char const*, tree_code)
/home/apinski/src/upstream-gcc/gcc/gcc/tree.h:3450
0x75c6b1 depset::hash::add_specializations(bool)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/module.cc:12971
0xb00fa5 module_state::write(elf_out*, cpp_reader*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/module.cc:17606
0xb02590 finish_module_processing(cpp_reader*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/module.cc:19876
0xa92a5b c_parse_final_cleanups()
/home/apinski/src/upstream-gcc/gcc/gcc/cp/decl2.c:5310
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.


Reducing.

[Bug c++/104507] [10/11 Regression] internal compiler error: unexpected expression ‘(int)(__ret)’ of kind cast_expr

2022-02-13 Thread junk at sigpwr dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104507

--- Comment #4 from Daniel Nelson  ---
Yeah, that was my thought as well (though I'm 99% unfamiliar with the GCC
codebase).

Some more bisecting reveals that this was introduced with
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95508

ae2ebf011fec926e003645c33c07a03619ea216a is the first bad commit
commit ae2ebf011fec926e003645c33c07a03619ea216a
Author: Marek Polacek 
Date:   Wed Jun 17 09:19:02 2020 -0400

c++: ICE with IMPLICIT_CONV_EXPR in array subscript [PR95508]
...

[Bug c++/104514] add feature to create a pointer to a fixed address as constexpr

2022-02-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104514

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #2)
> I thought there was another bug open asking for this same thing but I can't
> find it right now.

Oh yes PR 80886.

[Bug tree-optimization/104519] [12 Regression] wrong code at -Os on x86_64-linux-gnu and char as induction variable

2022-02-13 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104519

Jiu Fu Guo  changed:

   What|Removed |Added

 CC||guojiufu at gcc dot gnu.org

--- Comment #4 from Jiu Fu Guo  ---
Had a quick bisect and test,  this PR and 104521 seems caused by 
r12-7052-g0898049ad9bf6c46e510b18aaafca4946802749f.

[Bug target/103008] poor inlined builtin_fmod on x86_64

2022-02-13 Thread rguenther at suse dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103008

--- Comment #16 from rguenther at suse dot de  ---
On Fri, 11 Feb 2022, ubizjak at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103008
> 
> --- Comment #13 from Uroš Bizjak  ---
> (In reply to Richard Biener from comment #12)
> > Just as data-point on znver2 Uros testcase shows
> > 
> > rguenther@ryzen:/tmp> gcc-11 t.c -Ofast -lm -march=znver2
> > rguenther@ryzen:/tmp> numactl --physcpubind=3 /usr/bin/time ./a.out 
> > 19.18user 0.00system 0:19.18elapsed 99%CPU (0avgtext+0avgdata
> > 1528maxresident)k
> > 0inputs+0outputs (0major+76minor)pagefaults 0swaps
> > rguenther@ryzen:/tmp> gcc-11 t.c -Ofast -lm -march=znver2 -fno-builtin-fmod
> 
> You should use -fno-builtin-fmodf in the above compile flags.

Oops, yes.  Then the glibc version is

22.53user 0.00system 0:22.53elapsed 99%CPU (0avgtext+0avgdata 
1600maxresident)k
0inputs+0outputs (0major+77minor)pagefaults 0swaps

so indeed for float the x87 inline version is faster when benchmarked
this way.  For double it's

19.31user 0.00system 0:19.31elapsed 99%CPU (0avgtext+0avgdata 
1536maxresident)k
0inputs+0outputs (0major+76minor)pagefaults 0swaps

vs.

18.47user 0.00system 0:18.47elapsed 99%CPU (0avgtext+0avgdata 
1600maxresident)k
0inputs+0outputs (0major+77minor)pagefaults 0swaps

so glibc is a bit faster here while the x87 version is of course
similar.  Avoiding the libcall can of course avoid spilling SSE
regs around the call.

So what remains is really the special case in blender doing
fmod (x, 1.) which can eventually be optimized with SSE4.

[Bug tree-optimization/104501] vector lowering for VEC_COND_EXPR does not consider smaller vectors

2022-02-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104501

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #2 from Richard Biener  ---
yep

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

[Bug tree-optimization/55001] Handle VEC_COND_EXPR better in tree-vect-generic.c

2022-02-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55001

Richard Biener  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org

--- Comment #7 from Richard Biener  ---
*** Bug 104501 has been marked as a duplicate of this bug. ***

[Bug middle-end/88670] [meta-bug] generic vector extension issues

2022-02-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88670
Bug 88670 depends on bug 104501, which changed state.

Bug 104501 Summary: vector lowering for VEC_COND_EXPR does not consider smaller 
vectors
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104501

   What|Removed |Added

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

[Bug middle-end/102276] -ftrivial-auto-var-init fails to initialize a variable, causes a spurious warning

2022-02-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102276

--- Comment #6 from Richard Biener  ---
It's difficult, see the recent discussion on introducing explicit live-in
markers for the purpose of stack slot sharing and exactly these case of
testcases.

The "simplest" suggestion was to promote the variable to an outer scope when
such entry into the containing scope is detected.  But since we are doing
auto-init at gimplification time the new point of initializaton would need to
be computed before somehow.

Since you are getting a diagnostic which we could even improve to

warning: variable auto-init for `x' will never be executed

and you do like to get auto-init and you _can_ fix your code that's all
perfectly OK.

Yes, there might be a way to compute auto-init locations (! yes, multiple,
with obvious code-size impact) or a more conservative location (extending
the variable lifetime with the corresponding effect on stack slot sharing).
But clearly fixing the source is prefered.  Mind that when you write

int g(int *);
int f1()
{
switch (0) {
int x = 0;
default:
return g(&x);
}
}

you get the very same effect.  So IMHO -ftrivial-auto-var-init behaves
_exactly_ as one would assume it would, without doing any invisible
magic dances.

So yes, let's improve the diagnostic to be specific about each variable
that is not initialized (and maybe the following still unreachable stmt).

[Bug target/103008] poor inlined builtin_fmod on x86_64

2022-02-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103008

--- Comment #17 from Richard Biener  ---
(In reply to Uroš Bizjak from comment #14)
> Created attachment 52428 [details]
> Proposed patch
> 
> The attached patch implements:
> 
> fmod (a, p) = a - trunc (a/p) * p
> drem (a, p) = a - roundeven (a/p) * p
> 
> using SSE4 round instruction (and uses fnma when available).
> 
> Timings with Polyhedron ac.f90 on IvyBridge-E, Fedora-34, glibc 2.33-21.fc34
> 
> -Ofast:
>6,150082000 seconds user
> 
> -Ofast -mno-80387:
>   18,354654000 seconds user
> 
> -Ofast -msse4:
>5,722511000 seconds user

I fear this is a bit too much on the "unsafe" side.  Maybe we can
go this way for float but use double arithmetic for the fmod to avoid
the exponent issue?  For double, can we do some cheap range checking
and fall back to fmod() when not safe?

That said, can we have a flag like -mrecip to control this?

[Bug analyzer/104524] New: [12 Regression] ICE in get_or_create_cast, at analyzer/region-model-manager.cc:499

2022-02-13 Thread asolokha at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104524

Bug ID: 104524
   Summary: [12 Regression] ICE in get_or_create_cast, at
analyzer/region-model-manager.cc:499
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc 12.0.1 20220213 snapshot (g:58aeb75d4097010ad9bb72b964265b18ab284f93) ICEs
when compiling the following testcase, reduced from
gcc/testsuite/gcc.c-torture/execute/20010925-1.c, w/ -fanalyzer:

int src[1];

int
main (int c, char **a)
{
  __builtin_memcpy (*a, src, c);

  return 0;
}

% gcc-12.0.1 -fanalyzer -c gg3fyq9h.c
during IPA pass: analyzer
gg3fyq9h.c: In function 'main':
gg3fyq9h.c:6:3: internal compiler error: in get_or_create_cast, at
analyzer/region-model-manager.cc:499
6 |   __builtin_memcpy (*a, src, c);
  |   ^
0x7b4eaf ana::region_model_manager::get_or_create_cast(tree_node*, ana::svalue
const*)
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/region-model-manager.cc:499
0x12b5d48 ana::region_model_manager::maybe_fold_sub_svalue(tree_node*,
ana::svalue const*, ana::region const*)
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/region-model-manager.cc:764
0x12b5d48 ana::region_model_manager::get_or_create_sub_svalue(tree_node*,
ana::svalue const*, ana::region const*)
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/region-model-manager.cc:847
0x12dae75 ana::binding_cluster::get_any_binding(ana::store_manager*,
ana::region const*) const
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/store.cc:1477
0x1291adb ana::region_model::get_initial_value_for_global(ana::region const*)
const
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/region-model.cc:2034
0x12a7534 ana::region_model::impl_call_memcpy(ana::call_details const&)
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/region-model-impl-calls.cc:515
0x12a0a3a ana::region_model::on_call_pre(gcall const*,
ana::region_model_context*, bool*)
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/region-model.cc:1191
0x12a36e2 ana::region_model::on_stmt_pre(gimple const*, bool*, bool*,
ana::region_model_context*)
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/region-model.cc:1074
0x1270248 ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode
const*, gimple const*, ana::program_state*, ana::uncertainty_t*,
ana::path_context*)
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/engine.cc:1305
0x1273656 ana::exploded_graph::process_node(ana::exploded_node*)
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/engine.cc:3694
0x127467a ana::exploded_graph::process_worklist()
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/engine.cc:3137
0x1276d20 ana::impl_run_checkers(ana::logger*)
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/engine.cc:5716
0x1277c1e ana::run_checkers()
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/engine.cc:5787
0x12668f8 execute
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/analyzer/analyzer-pass.cc:87

[Bug target/103771] [12 Regression] Missed vectorization under -mavx512f -mavx512vl after r12-5489

2022-02-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771

--- Comment #37 from Richard Biener  ---
Is this now "good enough" for GCC 12?

[Bug tree-optimization/104519] [12 Regression] wrong code at -Os on x86_64-linux-gnu and char as induction variable

2022-02-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104519

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Priority|P3  |P1
Version|unknown |12.0
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

[Bug target/103771] [12 Regression] Missed vectorization under -mavx512f -mavx512vl after r12-5489

2022-02-13 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771

--- Comment #38 from Hongtao.liu  ---
(In reply to Richard Biener from comment #37)
> Is this now "good enough" for GCC 12?

Yes.

[Bug target/103771] [12 Regression] Missed vectorization under -mavx512f -mavx512vl after r12-5489

2022-02-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
   Target Milestone|12.0|13.0

--- Comment #39 from Richard Biener  ---
Fixed for the target regression part, Andrew is working on a more generic fix
for GCC 13.