[Bug d/103604] [12 Regression] trunk 20210506 fails to build in libphobos on mips64el-linux-gnu

2021-12-13 Thread syq at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103604

--- Comment #4 from YunQiang Su  ---
but where is the stat_t of D is defined?

[Bug d/103604] [12 Regression] trunk 20210506 fails to build in libphobos on mips64el-linux-gnu

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

ibuclaw at gcc dot gnu.org changed:

   What|Removed |Added

 CC||ibuclaw at gcc dot gnu.org

--- Comment #5 from ibuclaw at gcc dot gnu.org ---
(In reply to YunQiang Su from comment #4)
> but where is the stat_t of D is defined?
In libphobos/libdruntime/core/sys/posix/sys/stat.d

[Bug tree-optimization/103253] Unused COND_MUL isn't removed by DCE even with -fno-trapping-math

2021-12-13 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103253

Tamar Christina  changed:

   What|Removed |Added

   Priority|P1  |P3
Summary|[12 Regression] ICE:|Unused COND_MUL isn't
   |Segmentation fault (in  |removed by DCE even with
   |convert_mult_to_fma or in   |-fno-trapping-math
   |vect_recog_mask_conversion_ |
   |pattern) since  |
   |r12-5129-g8ed62c929c7c4462  |
   Keywords|ice-on-valid-code   |missed-optimization

--- Comment #13 from Tamar Christina  ---
ICE is fixed, underlying problem needs some checking but no longer a P1 or a
regression. Just a missed optimization.

[Bug tree-optimization/66502] SCCVN can't handle PHIs optimistically optimally

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

--- Comment #5 from Andrew Pinski  ---
(In reply to Richard Biener from comment #4)
> SCCVN preference changed.  Missed optimization remains (now the other
> variant).

GCC 10 looks like it can handle both now. I don't know if that means this can
be marked as fixed though.

gcc-bugs@gcc.gnu.org

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

--- Comment #2 from Andrew Pinski  ---
(In reply to Richard Biener from comment #0)
> Likewise
> &TARGET_MEM_REF[ptr_1 + 4] should be canonicalized to &MEM_REF[ptr_1 + 4]
> or even a POINTER_PLUS_EXPR.

We now canonicalized &MEM_REF[ptr_1 + 4] in gimple-fold to a POINTER_PLUS_EXPR.
I didn't handle &TARGET_MEM_REF though.

[Bug middle-end/103632] wrong code at -O2 on aarch64-unknown-linux-gnu

2021-12-13 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103632

Tamar Christina  changed:

   What|Removed |Added

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

--- Comment #3 from Tamar Christina  ---
This is a dup of PR103350

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

[Bug rtl-optimization/103350] [12 Regression] wrong code with -Os -fno-tree-ter on aarch64-unknown-linux-gnu since r12-2288-g8695bf78dad1a42636775843ca832a2f4dba4da3

2021-12-13 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103350

--- Comment #5 from Tamar Christina  ---
*** Bug 103632 has been marked as a duplicate of this bug. ***

[Bug ipa/103513] [12 Regression] ICE in evaluate_conditions_for_known_args, at ipa-fnsummary.c:516 with -O2 and above since r12-5531-g1b0acc4b800b589a

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

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

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

commit r12-5921-g3b61f06b2e1e7e72fcb6c0cf3590cb25eb92c4f2
Author: Jan Hubicka 
Date:   Mon Dec 13 09:38:53 2021 +0100

Do not ICE on ternary expressions when calculating value ranges

gcc/ChangeLog:

2021-12-12  Jan Hubicka  

PR ipa/103513
* ipa-fnsummary.c (evaluate_conditions_for_known_args): Do not ICE
on ternary expression.

gcc/testsuite/ChangeLog:

2021-12-12  Jan Hubicka  

PR ipa/103513
* gcc.c-torture/compile/pr103513.c: New test.

[Bug ipa/103513] [12 Regression] ICE in evaluate_conditions_for_known_args, at ipa-fnsummary.c:516 with -O2 and above since r12-5531-g1b0acc4b800b589a

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

Jan Hubicka  changed:

   What|Removed |Added

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

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

[Bug tree-optimization/82918] No aliasing is possible on non equal pointers

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

Andrew Pinski  changed:

   What|Removed |Added

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

[Bug rtl-optimization/40893] ARM and PPC truncate intermediate operations unnecessarily

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

Andrew Pinski  changed:

   What|Removed |Added

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

[Bug rtl-optimization/103350] [12 Regression] wrong code with -Os -fno-tree-ter on aarch64-unknown-linux-gnu since r12-2288-g8695bf78dad1a42636775843ca832a2f4dba4da3

2021-12-13 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103350

Tamar Christina  changed:

   What|Removed |Added

 CC||tnfchris at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |tnfchris at gcc dot 
gnu.org

--- Comment #6 from Tamar Christina  ---
This and the report in PR103632 are caused by a bug in REE where it generates
incorrect code.

It's trying to eliminate the following zero extension

(insn 54 90 102 2 (set (reg:V4SI 33 v1 [orig:94 _5 ] [94])
(zero_extend:V4SI (reg/v:V4HI 40 v8 [orig:112 v64u16_0D.3917 ] [112])))
"jon-inc.c":21:30 4106 {zero_extendv4hiv4si2}
 (nil))

by folding it in the definition of `v8`:

(insn 2 5 104 2 (set (reg/v:V4HI 40 v8 [orig:112 v64u16_0D.3917 ] [112])
(reg:V4HI 32 v0 [156])) "jon-inc.c":15:1 1160 {*aarch64_simd_movv4hi}
 (nil))

which is fine, except that `v8` is also used by the extracts, e.g.:

(insn 11 10 12 2 (set (reg:SI 1 x1 [orig:103 _17 ] [103])
(zero_extend:SI (vec_select:HI (reg/v:V4HI 40 v8 [orig:112
v64u16_0D.3917 ] [112])
(parallel [
(const_int 3 [0x3])
] 2480 {*aarch64_get_lane_zero_extendsiv4hi}
 (nil))

REE replaces insn 2 by folding insn 54 and placing it at the definition site of
insn 2, so before insn 11.

Trying to eliminate extension:
(insn 54 90 102 2 (set (reg:V4SI 33 v1 [orig:94 _5 ] [94])
(zero_extend:V4SI (reg/v:V4HI 40 v8 [orig:112 v64u16_0D.3917 ] [112])))
"jon-inc.c":21:30 4106 {zero_extendv4hiv4si2}
 (nil))
Tentatively merged extension with definition (copy needed):
(insn 2 5 104 2 (set (reg:V4SI 33 v1)
(zero_extend:V4SI (reg:V4HI 32 v0 [156]))) "jon-inc.c":15:1 -1
 (nil))

to produce

(insn 2 5 110 2 (set (reg:V4SI 33 v1)
(zero_extend:V4SI (reg:V4HI 32 v0 [156]))) "jon-inc.c":15:1 4106
{zero_extendv4hiv4si2}
 (nil))
(insn 110 2 104 2 (set (reg:V4SI 40 v8)
(reg:V4SI 33 v1)) "jon-inc.c":15:1 -1
 (nil))

The new insn 2 using v0 directly is correct, but the insn 110 it creates is
wrong, `v8` should still be V4HI.

or it also needs to eliminate the zero extension from the extracts, so instead
of

(insn 11 10 12 2 (set (reg:SI 1 x1 [orig:103 _17 ] [103])
(zero_extend:SI (vec_select:HI (reg/v:V4HI 40 v8 [orig:112
v64u16_0D.3917 ] [112])
(parallel [
(const_int 3 [0x3])
] 2480 {*aarch64_get_lane_zero_extendsiv4hi}
 (nil))

it should be

(insn 11 10 12 2 (set (reg:SI 1 x1 [orig:103 _17 ] [103])
(vec_select:SI (reg/v:V4SI 40 v8 [orig:112 v64u16_0D.3917 ] [112])
(parallel [
(const_int 3 [0x3])
]))) 2480 {*aarch64_get_lane_zero_extendsiv4hi}
 (nil))

without doing so the indices have been remapped in the extension and so we
extract the wrong elements

At any other optimization level but -Os ree seems to abort so this doesn't
trigger:

Trying to eliminate extension:
(insn 54 90 101 2 (set (reg:V4SI 32 v0 [orig:94 _5 ] [94])
(zero_extend:V4SI (reg/v:V4HI 40 v8 [orig:112 v64u16_0D.3917 ] [112])))
"jon-inc.c":21:30 4106 {zero_extendv4hiv4si2}
 (nil))
Elimination opportunities = 2 realized = 0

purely due to the ordering of instructions. REE doesn't check uses of `v8`
because it assumes that with a zero extended value, you still have access to
the lower bits by using the the bottom part of the register.

This is true for scalar but not for vector.  This would have been fine as well
if REE had eliminated the zero_extend on insn 11 and the rest but it doesn't do
so since REE can only handle cases where the SRC value are REG_P.

It does try to do this in add_removable_extension:

 1160  /* For vector mode extensions, ensure that all uses of the
 1161 XEXP (src, 0) register are in insn or debug insns, as unlike
 1162 integral extensions lowpart subreg of the sign/zero extended
 1163 register are not equal to the original register, so we have
 1164 to change all uses or none and the current code isn't able
 1165 to change them all at once in one transaction.  */

However this code doesn't trigger for the example because REE doesn't check the
uses if the defining instruction doesn't feed into another extension.. Which is
bogus. For vectors it should always check usages.

r12-2288-g8695bf78dad1a42636775843ca832a2f4dba4da3 simply exposed this as it
now lowers VEC_SELECT 0 into the RTL canonical form subreg 0 which causes REE
to run more often.

Mine.

[Bug target/103094] [12 Regression] AAPCS for new partial vector mode types (e.g. V2x8QI) are incorrect.

2021-12-13 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103094

Tamar Christina  changed:

   What|Removed |Added

 CC||jonathan.wright at arm dot com
   Priority|P3  |P1
Summary|[12 Regression] Incorrect   |[12 Regression] AAPCS for
   |codegen from uint8x8x2_t|new partial vector mode
   |function arguments  |types (e.g. V2x8QI) are
   ||incorrect.
   Assignee|unassigned at gcc dot gnu.org  |tnfchris at gcc dot 
gnu.org

--- Comment #5 from Tamar Christina  ---
The frame layout and argument layout code for the new structs are incorrect, it
leads to the compiler thinking that every pair of values only use a single
register.

i.e. V2x8QI is 16 bytes long, so the compiler thinks the values are packed in a
single register.  This causes any code that returns or passes these new types
as function arguments to be incorrect.

Mine.

[Bug c++/103678] [concepts] Constrained partial specialization of dependent template conflicts with unconstrained partial specialization

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

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-12-13
 Blocks||67491
 Ever confirmed|0   |1


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

[Bug gcov-profile/103652] Producing profile with -O2 -flto and trying to consume it with -O3 -flto leads to ICEs on indirect call profiling

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

--- Comment #1 from Martin Liška  ---
(In reply to Jan Hubicka from comment #0)
> Building clang in the funny way (training with -O2 -flto -fprofile-generate)
> and use with -O3 -flto -fprofile-generate I get ICE here:

Do you mean, -O3 -flto -fprofile-use, right?

I would have expected some -Werror=coverage-mismatch errors. Can you please
create a smaller reproducer where you see the error?

[Bug ipa/103669] [12 Regression] wrong code with -O --param=modref-max-depth=1 since r12-4976-g4898e958a92d45db

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

Martin Liška  changed:

   What|Removed |Added

Summary|[12 Regression] wrong code  |[12 Regression] wrong code
   |with -O |with -O
   |--param=modref-max-depth=1  |--param=modref-max-depth=1
   ||since
   ||r12-4976-g4898e958a92d45db
   Priority|P3  |P1
   Last reconfirmed||2021-12-13
 CC||hubicka at gcc dot gnu.org
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #1 from Martin Liška  ---
Started with r12-4976-g4898e958a92d45db.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

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

--- Comment #67 from Martin Liška  ---
(In reply to Arseny Solokha from comment #66)
> Should I file my commend 38 as a separate PR, then?

Yes, please.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

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

--- Comment #68 from Martin Liška  ---
> Righto. This is proving unexpectedly hard to reproduce.

Ok, so please tell me exact steps how to reproduce it.

[Bug gcov-profile/103652] Producing profile with -O2 -flto and trying to consume it with -O3 -flto leads to ICEs on indirect call profiling

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

--- Comment #2 from hubicka at kam dot mff.cuni.cz ---
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103652
> 
> --- Comment #1 from Martin Liška  ---
> (In reply to Jan Hubicka from comment #0)
> > Building clang in the funny way (training with -O2 -flto -fprofile-generate)
> > and use with -O3 -flto -fprofile-generate I get ICE here:
> 
> Do you mean, -O3 -flto -fprofile-use, right?
> 
> I would have expected some -Werror=coverage-mismatch errors. Can you please
> create a smaller reproducer where you see the error?
You need to disable those to build multithreaded programs like clang.  I
think you can produce testcase easily by making a function with one
indirect call for train run and many indirect calls in profile-use run.

I have patch to avoid the buffer overflow - can send it after getting to
office.

[Bug target/103661] __builtin_cpu_supports returns a negative integer for avx512vbmi2

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

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #5 from Martin Liška  ---
@Stefan: Great, can you please send the patch to the mailing list?

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-13 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #69 from David Binderman  ---
(In reply to Martin Liška from comment #68)
> > Righto. This is proving unexpectedly hard to reproduce.
> 
> Ok, so please tell me exact steps how to reproduce it.

First of all, get a -march=bdver2 machine. Install Fedora Linux.
Get recent gcc trunk.

Use this configure command:

../trunk.git/configure \
--disable-multilib \
--disable-werror \
--enable-checking=df,extra,fold,rtl,yes \
--enable-languages=c,c++

sed 's/-O2/-O3 -march=native/' < Makefile > Makefile.tmp
diff Makefile Makefile.tmp
mv Makefile.tmp Makefile

Build it and see what happens. I suspect that you won't need all the checking
flags I use. 

I also suspect that the recent fix for bug # 103515 might affect the
results, but let's see.

[Bug gcov-profile/103666] [11/12 Regression] compiling single-file preprocessed programs with -fprofile-generate no longer leads to intended results since r11-627-g1dedc12d186a1108

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

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
 CC||aoliva at gcc dot gnu.org
   Last reconfirmed||2021-12-13
Summary|compiling single-file   |[11/12 Regression]
   |preprocessed programs with  |compiling single-file
   |-fprofile-generate no   |preprocessed programs with
   |longer leads to intended|-fprofile-generate no
   |results |longer leads to intended
   ||results since
   ||r11-627-g1dedc12d186a1108

--- Comment #1 from Martin Liška  ---
Started with r11-627-g1dedc12d186a1108.

[Bug target/103675] gather is a loss for floats and win for doubles at zen3

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

Martin Liška  changed:

   What|Removed |Added

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

[Bug gcov-profile/103652] Producing profile with -O2 -flto and trying to consume it with -O3 -flto leads to ICEs on indirect call profiling

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

--- Comment #3 from Martin Liška  ---
> You need to disable those to build multithreaded programs like clang.

Well, I'm specifically speaking about:
error: the control flow of function ‘BZ2_compressBlock’ does not match its
profile data (counter ‘arcs’) 

this type of errors should not happen even in a multi-threaded programs.

> I think you can produce testcase easily by making a function with one
> indirect call for train run and many indirect calls in profile-use run.
> 
> I have patch to avoid the buffer overflow - can send it after getting to
> office.

Sure, please send it.

[Bug d/103604] [12 Regression] trunk 20210506 fails to build in libphobos on mips64el-linux-gnu

2021-12-13 Thread syq at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103604

--- Comment #6 from YunQiang Su  ---
Index: gcc-12-12-20211211/src/libphobos/libdruntime/core/sys/posix/sys/stat.d
===
--- gcc-12-12-20211211.orig/src/libphobos/libdruntime/core/sys/posix/sys/stat.d
+++ gcc-12-12-20211211/src/libphobos/libdruntime/core/sys/posix/sys/stat.d
@@ -347,7 +347,7 @@ version (CRuntime_Glibc)
 {
 c_ulong st_dev;
 int[3]  st_pad1;
-static if (!__USE_FILE_OFFSET64)
+static if (__WORDSIZE == 64 || !__USE_FILE_OFFSET64)
 {
 ino_t   st_ino;
 }
@@ -360,7 +360,7 @@ version (CRuntime_Glibc)
 uid_t   st_uid;
 gid_t   st_gid;
 c_ulong st_rdev;
-static if (!__USE_FILE_OFFSET64)
+static if (__WORDSIZE == 64 || !__USE_FILE_OFFSET64)
 {
 uint[2] st_pad2;
 off_t   st_size;
@@ -394,7 +394,7 @@ version (CRuntime_Glibc)
 }
 blksize_t   st_blksize;
 uintst_pad4;
-static if (!__USE_FILE_OFFSET64)
+static if (__WORDSIZE == 64 || !__USE_FILE_OFFSET64)
 {
 blkcnt_tst_blocks;
 }


This patch can solve this problem: of course, we need to back port it to
gcc-10/gcc-11 also.

The problem is due to that: 
N32 and N64 uses different "struct stat"
In the older version, __USE_FILE_OFFSET64 may be not defined for N64
 while now, it is defined.

[Bug d/103604] [12 Regression] trunk 20210506 fails to build in libphobos on mips64el-linux-gnu

2021-12-13 Thread syq at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103604

--- Comment #7 from YunQiang Su  ---
Where should we fallback this patch to?

Re: [Bug gcov-profile/103652] Producing profile with -O2 -flto and trying to consume it with -O3 -flto leads to ICEs on indirect call profiling

2021-12-13 Thread Jan Hubicka via Gcc-bugs
> 
> Well, I'm specifically speaking about:
> error: the control flow of function ‘BZ2_compressBlock’ does not match its
> profile data (counter ‘arcs’) 
> 
> this type of errors should not happen even in a multi-threaded programs.

There are some cases where I see even those on clang build - I am not
sure how that happens (if it is configury difference or generated code
or gcc bug) It is on my TODO to analyse...

In any case we should never ICE on malformed gcda files. Especially not
by buffer overflow :)
> 
> > I think you can produce testcase easily by making a function with one
> > indirect call for train run and many indirect calls in profile-use run.
> > 
> > I have patch to avoid the buffer overflow - can send it after getting to
> > office.
> 
> Sure, please send it.
Attached.

Honza
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 7f8b532cb52..49c370cb8c8 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -296,7 +296,7 @@ read_counts_file (void)
 
 gcov_type *
 get_coverage_counts (unsigned counter, unsigned cfg_checksum,
-unsigned lineno_checksum, unsigned int n_counts)
+unsigned lineno_checksum, unsigned int *n_counts)
 {
   counts_entry *entry, elt;
 
@@ -348,12 +348,12 @@ get_coverage_counts (unsigned counter, unsigned 
cfg_checksum,
   if (entry->cfg_checksum != cfg_checksum
   || (counter != GCOV_COUNTER_V_INDIR
  && counter != GCOV_COUNTER_V_TOPN
- && entry->n_counts != n_counts))
+ && entry->n_counts != *n_counts))
 {
   static int warned = 0;
   bool warning_printed = false;
 
-  if (entry->n_counts != n_counts)
+  if (entry->n_counts != *n_counts)
warning_printed =
  warning_at (DECL_SOURCE_LOCATION (current_function_decl),
  OPT_Wcoverage_mismatch,
@@ -361,7 +361,7 @@ get_coverage_counts (unsigned counter, unsigned 
cfg_checksum,
  "does not match "
  "its profile data (counter %qs, expected %i and have %i)",
  current_function_decl,
- ctr_names[counter], entry->n_counts, n_counts);
+ ctr_names[counter], entry->n_counts, *n_counts);
   else
warning_printed =
  warning_at (DECL_SOURCE_LOCATION (current_function_decl),
@@ -404,9 +404,25 @@ get_coverage_counts (unsigned counter, unsigned 
cfg_checksum,
  current_function_decl);
 }
 
+  *n_counts = entry->n_counts;
   return entry->counts;
 }
 
+/* Returns the counters for a particular tag and verifies that counts matches
+   the expectation.  */
+
+gcov_type *
+get_coverage_counts (unsigned counter, unsigned cfg_checksum,
+unsigned lineno_checksum, unsigned int n_counts)
+{
+  unsigned int n_counts2 = n_counts;
+  gcov_type *ret
+ = get_coverage_counts (counter, cfg_checksum,
+lineno_checksum, &n_counts2);
+  gcc_assert (!ret || n_counts2 == n_counts);
+  return ret;
+}
+
 /* Allocate NUM counters of type COUNTER. Returns nonzero if the
allocation succeeded.  */
 
diff --git a/gcc/coverage.h b/gcc/coverage.h
index 22646d439fc..7f488811a4e 100644
--- a/gcc/coverage.h
+++ b/gcc/coverage.h
@@ -54,6 +54,10 @@ extern gcov_type *get_coverage_counts (unsigned /*counter*/,
   unsigned /*cfg_checksum*/,
   unsigned /*lineno_checksum*/,
   unsigned /*n_counts*/);
+extern gcov_type *get_coverage_counts (unsigned /*counter*/,
+  unsigned /*cfg_checksum*/,
+  unsigned /*lineno_checksum*/,
+  unsigned */*n_counts*/);
 
 extern tree get_gcov_type (void);
 extern bool coverage_node_map_initialized_p (void);
diff --git a/gcc/profile.c b/gcc/profile.c
index d4103058fcd..0fe0910c296 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -898,7 +898,7 @@ compute_value_histograms (histogram_values values, unsigned 
cfg_checksum,
   histogram_counts[t] = get_coverage_counts (COUNTER_FOR_HIST_TYPE (t),
 cfg_checksum,
 lineno_checksum,
-n_histogram_counters[t]);
+&n_histogram_counters[t]);
   if (histogram_counts[t])
any = 1;
   act_count[t] = histogram_counts[t];
@@ -918,20 +918,47 @@ compute_value_histograms (histogram_values values, 
unsigned cfg_checksum,
   /* TOP N counter uses variable number of counters.  */
   if (topn_p)
{
- unsigned total_size;
+ gcov_type total_size;
+ bool ignore = false;
  if (act_count[t])
-   total_size = 2 + 2 * act_count[t][1];
+   {
+ total_size = 2 + 2 * act_count[t][1];
+ /* Watch for counter corrupt

[Bug gcov-profile/103652] Producing profile with -O2 -flto and trying to consume it with -O3 -flto leads to ICEs on indirect call profiling

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

--- Comment #4 from hubicka at kam dot mff.cuni.cz ---
> 
> Well, I'm specifically speaking about:
> error: the control flow of function ‘BZ2_compressBlock’ does not match its
> profile data (counter ‘arcs’) 
> 
> this type of errors should not happen even in a multi-threaded programs.

There are some cases where I see even those on clang build - I am not
sure how that happens (if it is configury difference or generated code
or gcc bug) It is on my TODO to analyse...

In any case we should never ICE on malformed gcda files. Especially not
by buffer overflow :)
> 
> > I think you can produce testcase easily by making a function with one
> > indirect call for train run and many indirect calls in profile-use run.
> > 
> > I have patch to avoid the buffer overflow - can send it after getting to
> > office.
> 
> Sure, please send it.
Attached.

Honza

[Bug d/103604] [12 Regression] trunk 20210506 fails to build in libphobos on mips64el-linux-gnu

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

ibuclaw at gcc dot gnu.org changed:

   What|Removed |Added

 Status|WAITING |ASSIGNED

--- Comment #8 from ibuclaw at gcc dot gnu.org ---
(In reply to YunQiang Su from comment #7)
> Where should we fallback this patch to?
I can submit it to upstream dlang/druntime (on github) and merged it in when I
next do the sync later this week.

[Bug tree-optimization/103680] New: Jump threading and switch corrupts profile

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

Bug ID: 103680
   Summary: Jump threading and switch corrupts profile
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

Hi,
with -fprofile-report is it now again possible to produce quite useful stats on
what passes misupdates profile.
I am attaching preport for FDO+LTO build of clang binary.  The column dynamic
mismatch is most relevant and show
number of executions of BB where profile is mismatched.

Clearly threadfull, vrp, ch, dom and switchlower seems main offenders.
cddce is also very high, but I think it is just making previous mismatches
worse - will look into that

It seems that the ranger threading revamp dropped profile updating code.
Andy, Jeff, I wonder what are your thoughts/plans on updating the profile here?

Profile consistency report:

Pass dump id and name|static mismatch|dynamic mismatch 
   |overall
  |
 |in count |out prob |in count 
|out prob  |size   |time   
  |
 79i cp  |   1245 +1245| 23   +23|793393361  
+793393361|0 |  6865717  | 38369447330388  
  |
 83i inline  |   2985 +1740|204  +181|  10286436405 
+9493043044|15236   +15236| 10407224+51.6%| 30175876351621 
 -21.4%|
 92t fixup_cfg   |   2985  |204  |  10286436405
|15236 | 10407224  | 30175876351621
|
 97t ompdevlow   |   2985  |204  |  10286436405
|15236 | 10407224  | 30175876351621
|
 99t adjust_alignment|   2985  |204  |  10286436405
|15236 | 10407224  | 30175876351621
|
100t ccp |   3690  +705|205+1|  10489595202  
+203158797|  1581960 +1566724| 10379522 -0.3%| 29996985353603  
 -0.6%|
101t objsz   |   3690  |205  |  10489595202
|  1581960 | 10379522  | 29996985353603
|
103t cunrolli|   3828  +138|205  |  10056896600  
-432698602|  1581960 | 10378081 -0.0%| 29950281172451  
 -0.2%|
104t backprop|   3828  |205  |  10056896600
|  1581960 | 10378081  | 29950281172451
|
105t phiprop |   3828  |205  |  10056896600
|  1581960 | 10387153 +0.1%| 29949755030810   
-0.0%|
106t forwprop|   3843   +15|205  |  10159477423  
+102580823|  1581960 | 10378573 -0.1%| 29895061666317  
 -0.2%|
107t alias   |   3843  |205  |  10159477423
|  1581960 | 10378573  | 29895061666317
|
108t retslot |   3843  |205  |  10159477423
|  1581960 | 10378573  | 29895061666317
|
109t fre |   5399 +1556|204-1|  19869551210 
+9710073787|15236 -1566724| 10134542 -2.4%| 28699013248678 
  -4.0%|
110t mergephi|   5278  -121|204  |  20025371186  
+155819976|15236 | 10134542  | 28699013248678  
  |
111t threadfull  |  72831 +67553|   1224 +1020| 202402568370
+182377197184|972775135   +972759899| 10206940 +0.7%| 28026521150697   
-2.3%|
112t vrp |  70137 -2694|   1276   +52| 216458254352
+14055685982|   1014740538+41965403| 10113204 -0.9%| 27883751110042
   -0.5%|
113t dse |  70069   -68|   1275-1| 216259198094  
-199056258|   1014740522  -16|  9976103 -1.4%| 27259758460246  
 -2.2%|
114t dce |  68646 -1423|   1251   -24| 213766589405 
-2492608689|   1010738219 -4002303|  9925029 -0.5%| 26929885571404 
  -1.2%|
115t stdarg  |  68646  |   1251  | 213766589405
|   1010738219 |  9925029  | 26929885571404
|
116t cdce|  68646  |   1251  | 213766589405
|   1010738219 |  9925029  | 26929885571404
|
117t cselim  |  68623   -23|   1251  | 213766434213
 -155192|   1010738219   

[Bug tree-optimization/103680] Jump threading and switch corrupts profile

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

Jan Hubicka  changed:

   What|Removed |Added

 CC||aldyh at gcc dot gnu.org,
   ||law at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org

--- Comment #1 from Jan Hubicka  ---
This is table to fit 80 column limit
Profile consistency report:

Pass dump id and name  |dynamic mismatch 
   |in count  |out prob  
 79i cp|793393361   +793393361|0 
 83i inline|  10286436405  +9493043044|15236   +15236
 92t fixup_cfg |  10286436405 |15236 
 97t ompdevlow |  10286436405 |15236 
 99t adjust_alignment  |  10286436405 |15236 
100t ccp   |  10489595202   +203158797|  1581960 +1566724
101t objsz |  10489595202 |  1581960 
103t cunrolli  |  10056896600   -432698602|  1581960 
104t backprop  |  10056896600 |  1581960 
105t phiprop   |  10056896600 |  1581960 
106t forwprop  |  10159477423   +102580823|  1581960 
107t alias |  10159477423 |  1581960 
108t retslot   |  10159477423 |  1581960 
109t fre   |  19869551210  +9710073787|15236 -1566724
110t mergephi  |  20025371186   +155819976|15236 
11t threadfull | 202402568370 +182377197184|972775135   +97275989
112t vrp   | 216458254352 +14055685982|   1014740538+41965403
113t dse   | 216259198094   -199056258|   1014740522  -16
114t dce   | 213766589405  -2492608689|   1010738219 -4002303
115t stdarg| 213766589405 |   1010738219 
116t cdce  | 213766589405 |   1010738219 
117t cselim| 213766434213  -155192|   1010738219 
118t copyprop  | 212518014812  -1248419401|   1003793990 -6944229
119t ifcombine | 215021849380  +2503834568|   1175015399   +171221409
120t mergephi  | 213958226983  -1063622397|   1170269374 -4746025
121t phiopt| 213278698412   -679528571|   1169780184  -489190
122t tailr | 213591827870   +313129458|   1169780184 
123t ch| 231773845670 +18182017800|   1169779155-1029
124t cplxlower | 231773845670 |   1169779155 
125t sra   | 231773845670 |   1169779155 
126t thread| 282837813276 +51063967606|   1884527067   +714747912
127t dom   | 289296055849  +6458242573|   1881062486 -3464580
128t copyprop  | 288791521291   -504534558|   1880452325  -610161
129t isolate-paths | 289175243159   +383721868|   1887100849 +6648524
130t reassoc   | 295644564738  +6469321579|   1886368237  -732612
131t dce   | 294937412703   -707152035|   1878493133 -7875104
132t forwprop  | 297646371403  +2708958700|   1878493133 
133t phiopt| 297639291119 -7080284|   1878493133 
134t ccp   | 297550679459-88611660|   1893125633+14632500
135t sincos| 297550679459 |   1893125633 
136t bswap | 297550679459 |   1893125633 
137t laddress  | 297550679459 |   1893125633 
138t lim   | 297859756610   +309077151|   1893125633 
139t walloca   | 297859756610 |   1893125633 
140t pre   | 299154507133  +1294750523|   1885986610 -7139023
141t sink  | 299366883910   +212376777|   1855713098-30273512
145t dse   | 299366883910 |   1855713098 
146t dce   | 299440495723+73611813|   1855713098 
147t fix_loops | 299440495723 |   1855713098 
148t loop  | 299440495723 |   1855713098 
149t loopinit  | 299440495723 |   1855713098 
150t unswitch  | 301091048942  +1650553219|   1855713098 
151t sccp  | 301090909602  -139340|   1855713098 
152t lsplit| 301901055378   +810145776|   1855713098 
153t lversion  | 301901055378 |   1855713098 
154t unrolljam

[Bug d/103604] [12 Regression] trunk 20210506 fails to build in libphobos on mips64el-linux-gnu

2021-12-13 Thread syq at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103604

--- Comment #9 from YunQiang Su  ---
(In reply to ibuclaw from comment #8)
> (In reply to YunQiang Su from comment #7)
> > Where should we fallback this patch to?
> I can submit it to upstream dlang/druntime (on github) and merged it in when
> I next do the sync later this week.

Thank you so much.

[Bug tree-optimization/103674] Poor codegen for C++ casts

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

Jan Hubicka  changed:

   What|Removed |Added

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

--- Comment #1 from Jan Hubicka  ---
Actually this looks like yet another full duplicate of PR95663

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

[Bug tree-optimization/95663] static_cast checks for null even when the pointer is dereferenced

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

Jan Hubicka  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org

--- Comment #19 from Jan Hubicka  ---
*** Bug 103674 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/95663] static_cast checks for null even when the pointer is dereferenced

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

--- Comment #20 from Jan Hubicka  ---
I really think with -fdelete-null-pointer-checks we should optimize away the
pointer adjustment relying on the fact that program will segfault.

I was wondering, -fdelete-null-pointer-checks currently requires pointer to be
precisely 0.  We are already iffy here since the access is at non-0 offset, but
since infer_nonnull_range_by_dereference uses check_loadstore:

static bool
check_loadstore (gimple *, tree op, tree, void *data)
{
  if (TREE_CODE (op) == MEM_REF || TREE_CODE (op) == TARGET_MEM_REF)
{
  /* Some address spaces may legitimately dereference zero.  */
  addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (op));
  if (targetm.addr_space.zero_address_valid (as))
return false;

  return operand_equal_p (TREE_OPERAND (op, 0), (tree)data, 0);
}
  return false;
}

which completely ignores MEM_REF_OFFSET we actually turn into trap accesses
that are arbitrarily far from NULL.  We also ignore handled components so we
miss this for example for variable array accesses I think.

However if we had --param null-pointer-zone defaulting to say 4k (a page size)
we could optimize all accesses that are near the NULL pointer.  This would let
us to optimize this correctly and also i.e. simplify ipa-pta that currently
special cases 0 as null but thinks that any other constat may point to any
global variable.  Small constants are common so this should optimize
noticeably.

For clang binary there are really many traps added by this logic that makes
code noticeably uglier than what clang generates on its own sources.

[Bug libstdc++/103664] std::regex_replace bug if the string contains \0

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

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

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

commit r12-5924-gef5d671cd80a4afa4f74c3dfe2904c63f51fcfde
Author: Jonathan Wakely 
Date:   Sun Dec 12 21:15:17 2021 +

libstdc++: Fix std::regex_replace for strings with embedded null [PR103664]

The overload of std::regex_replace that takes a std::basic_string as the
fmt argument (for the replacement string) is implemented in terms of the
one taking a const C*, which uses std::char_traits to find the length.
That means it stops at a null character, even though the basic_string
might have additional characters beyond that.

Rather than duplicate the implementation of the const C* one for the
std::basic_string case, this moves that implementation to a new
__regex_replace function which takes a const C* and a length. Then both
the std::basic_string and const C* overloads can call that (with the
latter using char_traits to find the length to pass to the new
function).

libstdc++-v3/ChangeLog:

PR libstdc++/103664
* include/bits/regex.h (__regex_replace): Declare.
(regex_replace): Use it.
* include/bits/regex.tcc (__regex_replace): Replace regex_replace
definition with __regex_replace.
* testsuite/28_regex/algorithms/regex_replace/char/103664.cc: New
test.

[Bug middle-end/103670] Incorrect optimization of loop termination: Early exit with any optimization

2021-12-13 Thread robert.muench at saphirion dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103670

Robert M. Münch  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|WAITING |RESOLVED

--- Comment #5 from Robert M. Münch  ---
This was a wrong positive, caused by some weird side effect originating in some
far away place.

[Bug fortran/103576] [12 Regression] gcc/fortran/openmp.c:7556:8: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare] since r12-5793-g689407ef916503b2f5a3c8c07fe7

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

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Tobias Burnus :

https://gcc.gnu.org/g:494ebfa7c9aacaeb6ec1fccc47a0e49f31eb2bb8

commit r12-5926-g494ebfa7c9aacaeb6ec1fccc47a0e49f31eb2bb8
Author: Tobias Burnus 
Date:   Mon Dec 13 12:37:40 2021 +0100

Fortran: Handle compare in OpenMP atomic

gcc/fortran/ChangeLog:

PR fortran/103576
* openmp.c (is_scalar_intrinsic_expr): Fix condition.
(resolve_omp_atomic): Fix/update checks, accept compare.
* trans-openmp.c (gfc_trans_omp_atomic): Handle compare.

libgomp/ChangeLog:

* libgomp.texi (OpenMP 5.1): Set Fortran support for atomic to 'Y'.
* testsuite/libgomp.fortran/atomic-19.f90: New test.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/atomic-25.f90: Remove sorry, fix + add checks.
* gfortran.dg/gomp/atomic-26.f90: Likewise.
* gfortran.dg/gomp/atomic-21.f90: New test.

[Bug fortran/103576] [12 Regression] gcc/fortran/openmp.c:7556:8: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare] since r12-5793-g689407ef916503b2f5a3c8c07fe7

2021-12-13 Thread burnus at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103576

Tobias Burnus  changed:

   What|Removed |Added

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

--- Comment #4 from Tobias Burnus  ---
Should be FIXED.

Thanks for the report.

[Bug libstdc++/103664] std::regex_replace bug if the string contains \0

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

Jonathan Wakely  changed:

   What|Removed |Added

 Blocks||102445

--- Comment #5 from Jonathan Wakely  ---
Fixed on trunk so far.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102445
[Bug 102445] [meta-bug] std::regex issues

[Bug c++/103672] [10/11/12 Regression] using with template class> causes internal compiler error

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

Jonathan Wakely  changed:

   What|Removed |Added

   Last reconfirmed||2021-12-13
   Keywords||ice-on-valid-code
  Known to work||10.2.0, 9.4.0
 CC||ppalka at gcc dot gnu.org
 Status|UNCONFIRMED |NEW
  Known to fail||10.3.0, 11.1.0, 12.0
Summary|using with  |[10/11/12 Regression] using
   |template |with
   |class> causes internal  |template
   |compiler error  |class> causes internal
   ||compiler error
 Ever confirmed|0   |1

--- Comment #1 from Jonathan Wakely  ---
This started to ICE on trunk with r11-6614

  c++: Fix ICE with CTAD in concept [PR98611]

It was also backported to 10.3 as r10-9635

[Bug d/103577] d21 SIGSEGV on Darwin/x86_64

2021-12-13 Thread ro at CeBiTec dot Uni-Bielefeld.DE via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103577

--- Comment #1 from ro at CeBiTec dot Uni-Bielefeld.DE  ---
> I recently tried to build master on Darwin 11 with gcc 11.0.1.  That's the
> first
> release to build gdc, and while libphobos isn't marked as supported in
> libphobos/configure.tgt, it does build with --enable-libphobos.
>
> However, with that gdc as bootstrap compiler, the resulting d21 SEGVs building
> the stage1 libphobos, e.g.

FWIW, I recently tried the same procedure in a macOS 12.1 VM
(x86_64-apple-darwin21.2.0).  This time, the build succeeded and test
results are reasonable

=== gdc Summary ===

# of expected passes11587
# of unsupported tests  2

=== libphobos Summary ===

# of expected passes556
# of unexpected failures7
# of unsupported tests  1

although I had to rerun the libphobos tests sequentially since several
would time out otherwise.

There's one caveat, though, that applies equally to Mac OS X 10.7 and
macOS 12.1: at least some of the stage1 dependency lists in gcc/d/.deps
are corrupt in that they contain D source code after the dependencies
proper, e.g. gcc/d/.deps/hash.Po:

d/root-hash.o: /vol/gcc/src/hg/master/darwin/gcc/d/dmd/root/hash.d
is.value == c.value;
}

override size_t getHash(scope const void* p) @trusted const
{
return getArrayHash(value, p, len);
}
[...]

I cannot yet tell if this is just an issue with GCC 11.1.0 gdc or
libphobos that's fixed in 11.2.0 or gcc-11 branch.

[Bug d/103577] d21 SIGSEGV on Darwin/x86_64

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

--- Comment #2 from Iain Buclaw  ---
(In reply to r...@cebitec.uni-bielefeld.de from comment #1)
> I cannot yet tell if this is just an issue with GCC 11.1.0 gdc or
> libphobos that's fixed in 11.2.0 or gcc-11 branch.


It could be this patch fixes that.

https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576395.html

It was requested to be backported back in November.

https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585450.html

[Bug other/103681] New: Unusual behavior for tail padding with different c++ standards

2021-12-13 Thread n.deshmukh at samsung dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103681

Bug ID: 103681
   Summary: Unusual behavior for tail padding with different c++
standards
   Product: gcc
   Version: 8.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: other
  Assignee: unassigned at gcc dot gnu.org
  Reporter: n.deshmukh at samsung dot com
  Target Milestone: ---

When I tried to link two modules which were compiled with different c++
standards, I observed that the offset of some fields of struct were different
when the same struct was accessed from both the modules. The issue is due to
the use of tail padding to allocate member variables in some standards (c++03,
c++11) and not with others (c++14, c++17). I created a small program to
reproduce the behaviour. 
-padding_error.cpp
#include 
#include 
#include 
struct A {
  int a;
  uint64_t b;
  int c = -1;
};
struct B : public A {
int d;
};
int main() {
std::cout << "sizeof(A): " << sizeof(A);
std::cout << ", sizeof(B): " << sizeof(B) << std::endl;
std::cout << "offset of d in B: " << (int)offsetof(B, d) << std::endl; 
}
--

The output of this program depends on the -std flag.
~$ /opt/rh/devtoolset-8/root/bin/g++ -std=c++03 padding_error.cpp -o c03
~$ ./c03
sizeof(A): 24, sizeof(B): 24
offset of d in B: 20
~$ /opt/rh/devtoolset-8/root/bin/g++ -std=c++11 padding_error.cpp -o c11
~$ ./c11
sizeof(A): 24, sizeof(B): 24
offset of d in B: 20
~$ /opt/rh/devtoolset-8/root/bin/g++ -std=c++14 padding_error.cpp -o c14
~$ ./c14
sizeof(A): 24, sizeof(B): 32
offset of d in B: 24
~$ /opt/rh/devtoolset-8/root/bin/g++ -std=c++17 padding_error.cpp -o c17
~$ ./c17
sizeof(A): 24, sizeof(B): 32
offset of d in B: 24


I tried with different versions of gcc but the output is the same. 
Because of the difference in the offset of the fields, I cannot link files
which were compiled with different -std flags. 

The issue can be reproduced with all the gcc compilers which support c++14.

[Bug tree-optimization/103680] Jump threading and switch corrupts profile

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

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #2 from Martin Liška  ---
I can confirm the switch lowering pass breaks profile update, it's mentioned
here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101301#c10 and I'm planning
to work on that in stage 3/4.

[Bug d/103577] d21 SIGSEGV on Darwin/x86_64

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

--- Comment #3 from Iain Buclaw  ---
FYI, with darwin, I've only been using the most recent commit in
releases/gcc-11 for testing as there have been a number of issues exposed from
that port.

I have VMs set-up running 10.4 (PPC), 10.6 (x86_64), 10.13, 10.14, 10.15, 11,
and 12.  Not yet gotten round to building a bootstrap compiler from gcc-11 just
yet though for testing build of master.

[Bug other/103681] Unusual behavior for tail padding with different c++ standards

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

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |blocker
   Keywords||ABI, wrong-code
 Ever confirmed|0   |1
   Last reconfirmed||2021-12-13
  Known to fail||12.0
 Status|UNCONFIRMED |NEW

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

Some more information from 
Jonathan Wakely:
The C++14 behaviour started with r216750

   Implement N3653 (Member initializers and aggregates) and fix
references to 'this' in constexpr cons
tructors.

   Implement N3653 (Member initializers and aggregates) and fix
   references to 'this' in constexpr constructors.
   * class.c (check_field_decls): In C++14 an NSDMI does not make the
   class non-aggregate.

But I think the layout should be using "POD for the purpose of
layout", which means the C++98 POD rules. Please do report it to
bugzilla.

[Bug tree-optimization/103682] New: [12 regression] ICE on atomics: gimple check: expected gimple_assign(error_mark), have gimple_nop() in gimple_assign_rhs_code, at gimple.h:2852

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

Bug ID: 103682
   Summary: [12 regression] ICE on atomics: gimple check: expected
gimple_assign(error_mark), have gimple_nop() in
gimple_assign_rhs_code, at gimple.h:2852
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

ICE extracted from a real project:

$ cat bug.cpp

  #include 

  bool bug(std::atomic & ready, unsigned u) {
return (ready.fetch_and(~u) & u);
  }

$ g++-12.0.0 -Ofast -c bug.cpp
during GIMPLE pass: fab
bug.cpp: In function 'bool bug(std::atomic&, unsigned int)':
bug.cpp:6:6: internal compiler error: gimple check: expected
gimple_assign(error_mark), have gimple_nop() in gimple_assign_rhs_code, at
gimple.h:2852
6 | bool bug(std::atomic & ready, unsigned u) {
  |  ^~~
0x20a58f7 internal_error(char const*, ...)
???:0
0x7c76dd gimple_check_failed(gimple const*, char const*, int, char const*,
gimple_code, tree_code)
???:0

$ g++-12.0.0 -v
Using built-in specs.
COLLECT_GCC=/nix/store/3x3yy5hhikzn8zvhq5fj14a2m9qyxbc8-gcc-12.0.0/bin/g++
COLLECT_LTO_WRAPPER=/nix/store/3x3yy5hhikzn8zvhq5fj14a2m9qyxbc8-gcc-12.0.0/libexec/gcc/x86_64-unknown-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211212 (experimental) (GCC)

[Bug tree-optimization/103682] [12 regression] ICE on atomics: gimple check: expected gimple_assign(error_mark), have gimple_nop() in gimple_assign_rhs_code, at gimple.h:2852

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

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
   Target Milestone|--- |12.0
 Target||x86_64-unknown-linux-gnu

[Bug tree-optimization/103682] [12 regression] ICE on atomics: gimple check: expected gimple_assign(error_mark), have gimple_nop() in gimple_assign_rhs_code, at gimple.h:2852 since r12-5486-g7df89377a

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

Martin Liška  changed:

   What|Removed |Added

 Ever confirmed|0   |1
Summary|[12 regression] ICE on  |[12 regression] ICE on
   |atomics: gimple check:  |atomics: gimple check:
   |expected|expected
   |gimple_assign(error_mark),  |gimple_assign(error_mark),
   |have gimple_nop() in|have gimple_nop() in
   |gimple_assign_rhs_code, at  |gimple_assign_rhs_code, at
   |gimple.h:2852   |gimple.h:2852 since
   ||r12-5486-g7df89377a7ae3906
   Last reconfirmed||2021-12-13
  Known to work||11.2.0
 CC||liuhongt at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org
 Status|UNCONFIRMED |NEW
  Known to fail||12.0

--- Comment #1 from Martin Liška  ---
Confirmed, started with r12-5486-g7df89377a7ae3906.

[Bug tree-optimization/103682] [12 regression] ICE on atomics: gimple check: expected gimple_assign(error_mark), have gimple_nop() in gimple_assign_rhs_code, at gimple.h:2852 since r12-5486-g7df89377a

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

--- Comment #2 from Andrew Pinski  ---
Confirmed.
C testcase:
int bug(unsigned *ready, unsigned u) {
   return __atomic_fetch_and (ready, ~u, 0) & u;
}

[Bug tree-optimization/103683] New: Redundant !__builtin_isnan not removed with -fno-signaling-nans

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

Bug ID: 103683
   Summary: Redundant !__builtin_isnan not removed with
-fno-signaling-nans
   Product: gcc
   Version: 11.2.0
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

If x is a NaN, then x > 1 will fail, so the __builtin_isnan function
could be removed in comparisons like (!__builtin_isnan (x)) && x > 1
lwhen -fno-signaling-nans is in effect.

Test case:

#include 
#include 

_Bool foo (double x)
{
  return (!__builtin_isnan (x)) && x > 1;
}

_Bool bar (double x)
{
  return x > 1;
}

void chk(double x)
{
  printf ("%f %x %x\n", x, foo(x), bar(x));
}
int main()
{
  chk(-1.0);
  chk(1.0);
  chk(2.9);
  chk(NAN);
  return 0;
}

With "gcc -fno-signaling-nans -S -O3 nan.c", one gets for foo

foo:
.seh_endprologue
ucomisd %xmm0, %xmm0
jp  .L3
comisd  .LC0(%rip), %xmm0
seta%al
ret

and for bar

bar:
.seh_endprologue
comisd  .LC0(%rip), %xmm0
seta%al
ret
.seh_endproc

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

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

--- Comment #70 from Martin Liška  ---
I'm sorry, but I don't have an access to a bdver2 machine.
Anyway, can you please debug what I asked in #c57?

[Bug d/103577] d21 SIGSEGV on Darwin/x86_64

2021-12-13 Thread ro at CeBiTec dot Uni-Bielefeld.DE via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103577

--- Comment #4 from ro at CeBiTec dot Uni-Bielefeld.DE  ---
> --- Comment #2 from Iain Buclaw  ---
> (In reply to r...@cebitec.uni-bielefeld.de from comment #1)
>> I cannot yet tell if this is just an issue with GCC 11.1.0 gdc or
>> libphobos that's fixed in 11.2.0 or gcc-11 branch.
>
>
> It could be this patch fixes that.
>
> https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576395.html
>
> It was requested to be backported back in November.
>
> https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585450.html

Seems quite plausible indeed.  I'll give the top of the gcc-11 branch a
whirl on both 10.7 and 12.  Maybe that's all it takes to get working
bootstrap compilers.

I previously took gcc 11.1.0 simply because I had the tree still around.

[Bug d/103577] d21 SIGSEGV on Darwin/x86_64

2021-12-13 Thread ro at CeBiTec dot Uni-Bielefeld.DE via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103577

--- Comment #5 from ro at CeBiTec dot Uni-Bielefeld.DE  ---
> --- Comment #3 from Iain Buclaw  ---
> FYI, with darwin, I've only been using the most recent commit in
> releases/gcc-11 for testing as there have been a number of issues exposed from
> that port.
>
> I have VMs set-up running 10.4 (PPC), 10.6 (x86_64), 10.13, 10.14, 10.15, 11,
> and 12.  Not yet gotten round to building a bootstrap compiler from gcc-11 
> just
> yet though for testing build of master.

Good to know.  Once the gcc-11 builds are done, I'll retry bootstrapping
master on 10.7 and 12.  Maybe the SEGVs on 10.7 stage1 will be gone that
way...

[Bug c++/103681] [9/10/11/12 Regression] Unusual behavior for tail padding with different c++ standards and NSDMI

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

Andrew Pinski  changed:

   What|Removed |Added

Summary|Unusual behavior for tail   |[9/10/11/12 Regression]
   |padding with different c++  |Unusual behavior for tail
   |standards and NSDMI |padding with different c++
   ||standards and NSDMI
   Target Milestone|--- |9.5

[Bug c++/103684] New: Ambiguous template template overload resolution

2021-12-13 Thread weidmann at acm dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103684

Bug ID: 103684
   Summary: Ambiguous template template overload resolution
   Product: gcc
   Version: 11.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: weidmann at acm dot org
  Target Milestone: ---

The following code compiles with -std=c++11, but does not with -std=c++17.
Works with clang.

#include 
#include 

template typename T> constexpr std::size_t hello()
{
return 2;
}

template typename T> constexpr
std::size_t hello()
{
return 3;
}

void foo()
{
auto i = hello();
auto j = hello();
}

[Bug c++/103684] Ambiguous template template overload resolution

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

--- Comment #1 from Andrew Pinski  ---
Reduced testcase:
template  struct f{};
template  struct g{};
template class T> constexpr int hello()
{
return 2;
}
template class T> constexpr int hello()
{
return 3;
}
void foo()
{
auto i = hello();
auto j = hello();
}

- CUT -
I think clang here is wrong, MSVC and ICC both reject it for the same reason as
GCC.  Basically it looks like clang is not taking into account the default
template arugments.

[Bug target/103625] ICE: in extract_insn, at recog.c:2769 (error: unrecognizable insn)

2021-12-13 Thread wschmidt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103625

--- Comment #7 from Bill Schmidt  ---
Oh, duh, sorry.  Yes, I can reproduce as well.

[Bug target/103625] ICE: in extract_insn, at recog.c:2769 (error: unrecognizable insn)

2021-12-13 Thread wschmidt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103625

--- Comment #8 from Bill Schmidt  ---
And Kewen's analysis is spot-on, will fix that.

[Bug c++/103684] Ambiguous template template overload resolution

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#150
[Moved to DR at the November, 2016 meeting as paper P0522R0.]

[Picked up by evolution group at October 2002 meeting.]


paper P0522R0:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0522r0.html

Anyways this used to be a GCC extension which was removed and then added back
as part of the C++ standard.  GCC is correct here in C++17 and above.

[Bug c++/82266] [DR150] Allowing more specialized argument than parameter for placeholder

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

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Keywords||accepts-invalid
  Alias||cwg150-1
   Last reconfirmed||2021-12-13
 Status|UNCONFIRMED |NEW

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

[Bug debug/78685] -Og generates too many ""s

2021-12-13 Thread mark at hotpy dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78685

mark at hotpy dot org changed:

   What|Removed |Added

 CC||mark at hotpy dot org

--- Comment #21 from mark at hotpy dot org ---
Debugging CPython is a real pain with GCC.

(gdb) p almost-any-useful-value
value has been optimised out

Isn't the point of -Og that values should be visible to the debugger?

[Bug target/103624] ICE: in extract_insn, at recog.c:2769 (error: unrecognizable insn)

2021-12-13 Thread wschmidt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103624

--- Comment #6 from Bill Schmidt  ---
We have __builtin_darn_32 for the 32-bit case.  The changes for the two
64-bit-only interfaces reflect the previous behavior.

[Bug c++/103684] Ambiguous template template overload resolution

2021-12-13 Thread weidmann at acm dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103684

--- Comment #3 from Nicolas Weidmann  ---
Ok, thanks for the update!

[Bug analyzer/103685] New: false positive error: dereference of NULL ‘params’ [CWE-476]

2021-12-13 Thread vt at altlinux dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103685

Bug ID: 103685
   Summary: false positive error: dereference of NULL ‘params’
[CWE-476]
   Product: gcc
   Version: 11.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: vt at altlinux dot org
  Target Milestone: ---

Obvious false positive:

gost_ec_sign.c: In function ‘fill_GOST_EC_params’:
gost_ec_sign.c:105:15: error: dereference of NULL ‘params’ [CWE-476]
[-Werror=analyzer-null-dereference]
  105 | if (params->group) {
  | ~~^~~
  ‘fill_GOST_EC_params’: events 1-3
|
|  100 | if (!eckey || !params) {
|  |^
|  ||
|  |(1) following ‘false’ branch...
|..
|  105 | if (params->group) {
|  | ~~  ~
|  | | |
|  | | (3) dereference of NULL ‘params’
|  | (2) ...to here
|


With the code like this:

  100 if (!eckey || !params) {
  101 GOSTerr(GOST_F_FILL_GOST_EC_PARAMS,
GOST_R_UNSUPPORTED_PARAMETER_SET);
  102 return 0;
  103 }
  104
  105 if (params->group) {

This is on compiling https://github.com/gost-engine/engine/

Back reference:
https://github.com/gost-engine/engine/issues/245#issuecomment-992007686

[Bug c++/82266] [DR150] Allowing more specialized argument than parameter for placeholder

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

--- Comment #2 from Andrew Pinski  ---
Note I put a in the alias because we had an ever older bug where GCC was
implementing DR150 even before it became part of the standard (before auto
even).

[Bug target/103686] New: ICE in rs6000_expand_new_builtin at rs6000-call.c:15946

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

Bug ID: 103686
   Summary: ICE in rs6000_expand_new_builtin at
rs6000-call.c:15946
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-invalid-code
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---
  Host: x86_64-linux-gnu
Target: ppc64-linux-gnu

The following crashes:

$ ppc64-linux-gnu-gcc
/home/marxin/Programming/gcc/gcc/testsuite/gcc.target/powerpc/pr102347.c -c
-mno-fold-gimple
gimple folding of rs6000 builtins has been disabled.
gimple folding of rs6000 builtins has been disabled.
gimple folding of rs6000 builtins has been disabled.
gimple folding of rs6000 builtins has been disabled.
gimple folding of rs6000 builtins has been disabled.
gimple folding of rs6000 builtins has been disabled.
gimple folding of rs6000 builtins has been disabled.
during RTL pass: expand
/home/marxin/Programming/gcc/gcc/testsuite/gcc.target/powerpc/pr102347.c: In
function ‘main’:
/home/marxin/Programming/gcc/gcc/testsuite/gcc.target/powerpc/pr102347.c:13:3:
internal compiler error: Segmentation fault
   13 |   __builtin_mma_disassemble_acc (b, &c);
  |   ^
0xb6e79f crash_signal
   
/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-ppc64/build/gcc/toplev.c:322
0x7787d42f ???
   
/usr/src/debug/glibc-2.34-4.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0

[Bug target/103686] ICE in rs6000_expand_new_builtin at rs6000-call.c:15946

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

Martin Liška  changed:

   What|Removed |Added

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

[Bug target/103622] [12 Regression] ICE: Segmentation fault (in altivec_resolve_new_overloaded_builtin)

2021-12-13 Thread wschmidt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103622

--- Comment #7 from Bill Schmidt  ---
It seems to me the problem is that long double was resolved to _Float128 when
there is no _Float128 support on the target.  There is no specific overloaded
interface that accepts "long double," so there must have been type coercion
involved here.

[Bug tree-optimization/103680] Jump threading and switch corrupts profile

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
jump threading one was filed a long time ago as PR 25623.

[Bug gcov-profile/103652] Producing profile with -O2 -flto and trying to consume it with -O3 -flto leads to ICEs on indirect call profiling

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

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #5 from Martin Liška  ---
(In reply to hubicka from comment #4)
> Created attachment 51988 [details]
> buffer
> 

The patch is fine, please test it and install it.

[Bug ipa/103636] [12 Regression] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate

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

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

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

commit r12-5931-g9eb8785b3fa3a180bd216cf68b53f1621628efc6
Author: Martin Liska 
Date:   Fri Dec 10 11:40:54 2021 +0100

inline: fix ICE with -fprofile-generate

PR ipa/103636

gcc/ChangeLog:

* ipa-inline.c (can_inline_edge_p): Move logic checking
no_profile_instrument_function logic to ...
(can_early_inline_edge_p): ... here.

[Bug ipa/103636] [12 Regression] Clang build fails with -flto -fno-strict-aliaisng -flifetime-dse=1 -fprofile-generate

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

Martin Liška  changed:

   What|Removed |Added

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

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

[Bug target/103622] [12 Regression] ICE: Segmentation fault (in altivec_resolve_new_overloaded_builtin)

2021-12-13 Thread wschmidt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103622

--- Comment #8 from Bill Schmidt  ---
Hm, no, it's probably just that it's iterating looking for long double and runs
across this instance with an uninitialized function type.  So this patch solves
the problem:

diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 8e83d97e72f..fc4cc929884 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -2943,6 +2943,12 @@ altivec_resolve_new_overloaded_builtin (location_t loc,
tree fndecl,

for (; instance != NULL; instance = instance->next)
  {
+   /* It is possible for an instance to require a data type that isn't
+  defined on this target, in which case instance->fntype will be
+  NULL.  */
+   if (!instance->fntype)
+ continue;
+
bool mismatch = false;
tree nextparm = TYPE_ARG_TYPES (instance->fntype);

[Bug tree-optimization/26731] Jump threading gets in the way of loops

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

--- Comment #5 from Andrew Pinski  ---
In GCC 9 and above we get:
  _2 = x_6(D) + 1;
  _7 = (unsigned int) n_1;
  _11 = _7 + 4294967295;
  _15 = (int) _11;
  _16 = n_1 > 0 ? _15 : 0;
  x_3 = _2 + _16;

Which is okish, the loop has been removed but the above should be able to
reduce further:
  # RANGE [1, 2147483647] NONZERO 2147483647
  # n_1 = PHI 
  # RANGE [-2147483647, 2147483647]
  _2 = x_6(D) + 1;
  # RANGE [1, 2147483647] NONZERO 2147483647
  _7 = (unsigned int) n_1;
  # RANGE [0, 2147483646] NONZERO 2147483647
  _11 = _7 + 4294967295;
  # RANGE [0, 2147483646] NONZERO 2147483647
  _15 = (intD.9) _11;
  # RANGE [0, 2147483646] NONZERO 2147483647
  _16 = n_1 > 0 ? _15 : 0;
  x_3 = _2 + _16;

The COND_EXPR should just converted into _15 but we don't ...
VRP should have done that 

[Bug tree-optimization/103523] [11 Regression] vectorizable_induction generating code for modes without checking support for them by r11-7861-ge4180ab2f

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

--- Comment #10 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Joel Hutton :

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

commit r11-9380-gf2cc8d059df8aea1b811a4a68512d137f4e83bd5
Author: Joel Hutton 
Date:   Fri Dec 10 10:26:42 2021 +

pr103523: Check for PLUS/MINUS support

Check for PLUS_EXPR/MINUS_EXPR support in vectorizable_induction.
PR103523 is an ICE on valid code:

void d(float *a, float b, int c) {
float e;
for (; c; c--, e += b)
  a[c] = e;
}

This is due to not checking for PLUS_EXPR support, which is missing in
VNx2sf mode. This causes an ICE at expand time. This patch adds a check
for support in vectorizable_induction.

gcc/ChangeLog:

PR tree-optimization/103523
* tree-vect-loop.c (vectorizable_induction): Check for
PLUS_EXPR/MINUS_EXPR support.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pr103523.c: New test.

[Bug c++/83145] Ambiguous overload with templates, only GCC7 C++17 mode

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

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
Summary|Ambiguous overload with |Ambiguous overload with
   |templates, only GCC7 C++17  |templates, only GCC7 C++17
   |mode (regression?)  |mode
   Keywords||rejects-valid
   Last reconfirmed||2021-12-13
 Status|UNCONFIRMED |NEW

--- Comment #4 from Andrew Pinski  ---
Confirmed for the testcase in comment #3.

[Bug middle-end/103372] Warning on failure order defaulting to SEQ_CST if not a compile time constant

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
Note C++17 removed this restriction too, see PR 102177.

[Bug ipa/79857] cgraph_node::verify_node should call internal_error instead of error

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

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |WONTFIX
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=79856
 Status|NEW |RESOLVED

--- Comment #5 from Andrew Pinski  ---
Won't fix like PR 79856.

[Bug target/103686] ICE in rs6000_expand_new_builtin at rs6000-call.c:15946

2021-12-13 Thread wschmidt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103686

--- Comment #1 from Bill Schmidt  ---
I think that the MMA implementation is incompatible with -mno-fold-gimple. 
We'll need to prevent that flag combination, I think.

[Bug libstdc++/103687] New: [12 regression] several time/date failures after r12-5898

2021-12-13 Thread seurer at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103687

Bug ID: 103687
   Summary: [12 regression] several time/date failures after
r12-5898
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: seurer at gcc dot gnu.org
  Target Milestone: ---

g:c82e492616e343b6d6db218d2b498267bac899de, r12-5898

FAIL: 22_locale/time_get/get/char/3.cc execution test
FAIL: 22_locale/time_get/get/char/3.cc execution test
FAIL: 22_locale/time_get/get/wchar_t/3.cc execution test
FAIL: 22_locale/time_get/get/wchar_t/3.cc execution test
FAIL: 22_locale/time_get/get_date/char/12791.cc execution test
FAIL: 22_locale/time_get/get_date/char/12791.cc execution test
FAIL: 22_locale/time_get/get_date/wchar_t/12791.cc execution test
FAIL: 22_locale/time_get/get_date/wchar_t/12791.cc execution test
FAIL: 22_locale/time_get/get_time/char/2.cc execution test
FAIL: 22_locale/time_get/get_time/char/2.cc execution test
FAIL: 22_locale/time_get/get_time/char/5.cc execution test
FAIL: 22_locale/time_get/get_time/char/wrapped_env.cc execution test
FAIL: 22_locale/time_get/get_time/char/wrapped_env.cc execution test
FAIL: 22_locale/time_get/get_time/char/wrapped_locale.cc execution test
FAIL: 22_locale/time_get/get_time/char/wrapped_locale.cc execution test
FAIL: 22_locale/time_get/get_time/wchar_t/2.cc execution test
FAIL: 22_locale/time_get/get_time/wchar_t/2.cc execution test
FAIL: 22_locale/time_get/get_time/wchar_t/5.cc execution test
FAIL: 22_locale/time_get/get_time/wchar_t/wrapped_env.cc execution test
FAIL: 22_locale/time_get/get_time/wchar_t/wrapped_env.cc execution test
FAIL: 22_locale/time_get/get_time/wchar_t/wrapped_locale.cc execution test
FAIL: 22_locale/time_get/get_time/wchar_t/wrapped_locale.cc execution test

The error seems to be this:
/home/seurer/gcc/git/gcc-test/libstdc++-v3/testsuite/22_locale/time_get/get_time/wchar_t/2.cc:62:
void test02(): Assertion 'errorstate == ios_base::eofbit' failed.

This is a powerpc64 big endian system and it fails for both 32 and 64 bit runs.
 This update works fine on powerpc64 little endian.

commit c82e492616e343b6d6db218d2b498267bac899de
Author: Jakub Jelinek 
Date:   Fri Dec 10 17:01:28 2021 +0100

libstdc++: Some time_get fixes [PR78714]

[Bug libstdc++/103687] [12 regression] several time/date failures after r12-5898

2021-12-13 Thread seurer at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103687

--- Comment #1 from seurer at gcc dot gnu.org ---
It looks like a couple of these fail on some LE systems, too:

FAIL: 22_locale/time_get/get_time/char/2.cc execution test
FAIL: 22_locale/time_get/get_time/wchar_t/2.cc execution test

[Bug c++/65157] Unable to define a static template member function of a nested class as a friend of a sibling class.

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
Confirmed, the following should compile too but does not:
template 
class A {
 public:
  class C;
  template  static void d();
};

template 
class A::C {
 C();
 friend void A::d();
};

template  template 
void A::d() {
  C a{};
}

int main() {
  A::d();
}
 CUT ---
the original testcase which had "C() = default;" is able to compile in GCC 9+
but the friend is not really recognized.

[Bug c++/65157] Unable to define a static template member function of a nested class as a friend of a sibling class.

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

--- Comment #4 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #3)


Note if I change d not to be a template, then GCC is able to recognize the
friend and the code compiles.

[Bug analyzer/103233] Warning from system libraries in user code: CWE-476 -Werror=analyzer-null-dereference

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

Jonathan Wakely  changed:

   What|Removed |Added

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

--- Comment #9 from Jonathan Wakely  ---
Closing as WONTFIX, even though it will get fixed eventually, once C++ is
supported.

[Bug tree-optimization/95663] static_cast checks for null even when the pointer is dereferenced

2021-12-13 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95663

--- Comment #21 from Jeffrey A. Law  ---
I don't think there's anything inherently wrong with treating 0 + small offset
similarly to 0 when it comes to -fdelete-null-pointer-checks.   I suspect it'll
break some poorly written low level code, though we fixed up some of that a
year or so ago in response to some of Martin's diagnostic work which was
flagging 0 + offset as problematical.

[Bug c++/100339] [9/10/11/12 Regression] Bogus "should have been declared inside" error with friend

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

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||8.1.0
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-12-13
  Known to work||4.1.2, 5.1.0, 7.1.0, 7.5.0

--- Comment #3 from Andrew Pinski  ---
Confirmed.
ICC warns but still accepts it:
(5): warning #1098: the qualifier on this friend declaration is ignored
friend void ::fn(int);
^

[Bug c++/101356] The non-public member of a local class cannot be accessed by a friend of the class

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

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed|2021-08-02 00:00:00 |2021-12-13
 Blocks||65608

--- Comment #2 from Andrew Pinski  ---
When we do friend void ::show(); we get the following warning:

: In function 'auto fun()':
:5:21: warning: 'void show()' has not been declared within '::'
5 | friend void ::show();
  | ^~
:3:10: note: only here as a 'friend'
3 | void show();
  |  ^~~~


And even this is rejected:
namespace A {
void show();
}
auto fun(){
struct C{
friend void A::show();
private:
  int c;
};
return C{};
}
void A::show(){
   auto o = fun();
   o.c = 0;
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65608
[Bug 65608] [meta-bug] friend issues

[Bug c++/91618] template-id required to friend a function template, even for a qualified-id

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #8 from Andrew Pinski  ---
Even though PR 100339 is newer, it has more details on the issue and even
references the revision which introduced the regressions so closing this issue
as a dup of bug 100339.

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

[Bug c++/100339] [9/10/11/12 Regression] Bogus "should have been declared inside" error with friend

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||barry.revzin at gmail dot com

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

[Bug c++/91618] template-id required to friend a function template, even for a qualified-id

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #9 from Andrew Pinski  ---
Actually lets do it the other way around.

[Bug c++/100339] [9/10/11/12 Regression] Bogus "should have been declared inside" error with friend

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

Andrew Pinski  changed:

   What|Removed |Added

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

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

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

[Bug c++/91618] [9/10/11/12 Regression] template-id required to friend a function template, even for a qualified-id

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

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

[Bug c++/103534] [12 regression] Spurious -Wstringop-overflow warning with std::string concatencation

2021-12-13 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103534

Jason Merrill  changed:

   What|Removed |Added

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

--- Comment #11 from Jason Merrill  ---
Fixed.

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

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

Bug 103534 Summary: [12 regression] Spurious -Wstringop-overflow warning with 
std::string concatencation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103534

   What|Removed |Added

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

[Bug tree-optimization/103332] [12 Regression] Spurious -Wstringop-overflow on string concatenation in libstdc++ tests

2021-12-13 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103332

Jason Merrill  changed:

   What|Removed |Added

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

--- Comment #7 from Jason Merrill  ---
Same append issue.

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

[Bug c++/103534] [12 regression] Spurious -Wstringop-overflow warning with std::string concatencation

2021-12-13 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103534

Jason Merrill  changed:

   What|Removed |Added

 CC||redi at gcc dot gnu.org

--- Comment #12 from Jason Merrill  ---
*** Bug 103332 has been marked as a duplicate of this bug. ***

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

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

Bug 103332 Summary: [12 Regression] Spurious -Wstringop-overflow on string 
concatenation in libstdc++ tests
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103332

   What|Removed |Added

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

[Bug target/103622] [12 Regression] ICE: Segmentation fault (in altivec_resolve_new_overloaded_builtin)

2021-12-13 Thread wschmidt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103622

--- Comment #9 from Bill Schmidt  ---
Patch posted here:  

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

  1   2   3   >