[Bug debug/101266] New: ICE with -g: in loc_list_from_tree_1, at dwarf2out.c:19421

2021-06-29 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101266

Bug ID: 101266
   Summary: ICE with -g: in loc_list_from_tree_1, at
dwarf2out.c:19421
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210630 (experimental) [master revision
:ddd6233e0:ed392e9db434898eccec81edd85323d21d555fe9] (GCC)

$ cat mutant.c
typedef U;
fn8(U (*)[(int){1}]) {}

$ gcc-trunk -w -g mutant.c
mutant.c:2:1: internal compiler error: in loc_list_from_tree_1, at
dwarf2out.c:19421
2 | fn8(U (*)[(int){1}]) {}
  | ^~~
0x6b1ad0 loc_list_from_tree_1
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:19421
0xb224ad loc_list_from_tree_1
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:18927
0xb224ad loc_list_from_tree_1
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:18927
0xb22f18 loc_list_from_tree_1
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:19245
0xb25f1b loc_list_from_tree
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:19518
0xb319a5 add_scalar_info
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:21265
0xb32bce add_subscript_info
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:21507
0xb1d7b7 gen_array_type_die
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:22378
0xb1d7b7 gen_type_die_with_usage
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:26125
0xb1edd6 gen_type_die
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:26187
0xb3806e gen_decl_die
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:26826
0xb39296 dwarf2out_decl
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:27381
0xb39460 dwarf2out_type_decl
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:27099
0xb39460 dwarf2out_type_decl
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/dwarf2out.c:27094
0xe30b7a rest_of_decl_compilation(tree_node*, int, int)
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/passes.c:251
0x8f2ca7 finish_decl(tree_node*, unsigned int, tree_node*, tree_node*,
tree_node*)
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/c/c-decl.c:5606
0x8f692e grokdeclarator
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/c/c-decl.c:7171
0x8fa813 push_parm_decl(c_parm const*, tree_node**)
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/c/c-decl.c:5896
0x943079 c_parser_parms_list_declarator
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/c/c-parser.c:4291
0x9433ec c_parser_parms_declarator
/tmp/tmp.uZ7IoZqhUx-gcc-builder/gcc/gcc/c/c-parser.c:4217
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug middle-end/101264] [12 Regression] ICE in vect_optimize_slp, at tree-vect-slp.c:3880

2021-06-29 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101264

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org
 Ever confirmed|0   |1
   Last reconfirmed||2021-06-30
 Status|UNCONFIRMED |NEW

[Bug middle-end/101262] GCC11 OpenMP optimization causes sigsegv on aligned constant array in darktable

2021-06-29 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101262

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #5 from Martin Liška  ---
I'm willing to debug the original darktable binary, but I will need a proper
reproducer and steps what to do.

[Bug middle-end/101261] clones for target_clones attribute cannot be created when compilling with -fno-semantic-interposition

2021-06-29 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101261

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 CC||marxin at gcc dot gnu.org
 Ever confirmed|0   |1
   Assignee|unassigned at gcc dot gnu.org  |marxin at gcc dot 
gnu.org
   Last reconfirmed||2021-06-30

--- Comment #2 from Martin Liška  ---
I'll take a look.

[Bug middle-end/101262] GCC11 OpenMP optimization causes sigsegv on aligned constant array in darktable

2021-06-29 Thread johnnybit at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101262

--- Comment #4 from Hubert Kowalski  ---
I tried to generate a reproducer based of off code that in linked reports is
"guaranteed to crash" when compilled with GCC 11. My feel is that since it
doesn't work in isolation there's more moving parts to it. Common points in
linked reports are: same piece of code crashes when compilled with GCC11,
RelWithDebInfo target and the same code works correct when compilled with gcc
10.

[Bug libstdc++/71367] std::time_get does not implement 'r' or 'p'

2021-06-29 Thread xry111 at mengyan1223 dot wang via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71367

--- Comment #7 from Xi Ruoyao  ---
Any progress on this (after two years? :)

[Bug other/91085] fixincludes breaks

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91085

--- Comment #18 from CVS Commits  ---
The master branch has been updated by Xi Ruoyao :

https://gcc.gnu.org/g:6bf383c37e6131a8e247e8a0997d55d65c830b6d

commit r12-1924-g6bf383c37e6131a8e247e8a0997d55d65c830b6d
Author: Xi Ruoyao 
Date:   Mon Jun 28 13:54:58 2021 +0800

fixinc: don't "fix" machine names in __has_include(...) [PR91085]

fixincludes/

PR other/91085
* fixfixes.c (check_has_inc): New static function.
  (machine_name_fix): Don't replace header names in
  __has_include(...).
* inclhack.def (machine_name): Adjust test.
* tests/base/testing.h: Update.

[Bug target/101248] [AVX512] The upper bits of FIXUPIMMS{S,D} should come from src1 not dest.

2021-06-29 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101248

Hongtao.liu  changed:

   What|Removed |Added

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

--- Comment #4 from Hongtao.liu  ---
Fixed in GCC12.

[Bug target/101248] [AVX512] The upper bits of FIXUPIMMS{S,D} should come from src1 not dest.

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101248

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

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

commit r12-1923-ged392e9db434898eccec81edd85323d21d555fe9
Author: liuhongt 
Date:   Mon Jun 28 19:27:23 2021 +0800

The upper bits of FIXUPIMMS{S,D} should come from src1 not dest.

gcc/ChangeLog:

PR target/101248
* config/i386/sse.md
(avx512f_sfixupimm):
Refined to ..
(avx512f_sfixupimm):
this.
(avx512f_sfixupimm_mask"): Refined.
* config/i386/subst.md (maskz_scalar): New define_subst.
(maskz_scalar_name): New subst_attr.
(maskz_scalar_op5): Ditto.
(round_saeonly_maskz_scalar_op5): Ditto.
(round_saeonly_maskz_scalar_operand5): Ditto.

gcc/testsuite/ChangeLog

PR target/101248
* gcc.target/i386/pr101248.c: New test.

[Bug tree-optimization/101256] [12 Regression] Wrong code with -O3 since r12-1841-g9fe9c45ae33a2df7

2021-06-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101256

--- Comment #3 from Andrew Pinski  ---
Created attachment 51087
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51087=edit
Patch which I am testing

[Bug tree-optimization/101260] Backport 27381e78925 to GCC 11

2021-06-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101260

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
I thought r12-145 was a missed-optimization fix and such generally undesirable
to backport, plus it introduced PR100492 and PR101009 regressions.

[Bug middle-end/101262] GCC11 OpenMP optimization causes sigsegv on aligned constant array in darktable

2021-06-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101262

--- Comment #3 from Jakub Jelinek  ---
Can't reproduce with -O2 -fopenmp, neither with 10.3.1 20210422, nor current 11
branch, nor current trunk.

[Bug libstdc++/101258] std ::is_integral_v is undocumented

2021-06-29 Thread giecrilj at stegny dot 2a.pl via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101258

--- Comment #4 from Christopher Yeleighton  ---
(In reply to Jonathan Wakely from comment #1)
> It does exactly what the standard says it does. And it's self explanatory.

What is self-explanatory in is_integral_v?  It could be "is integral verbose"
or "is integral equal to Roman numeral v" or "is integral virtually" or
anything else.

[Bug libstdc++/101258] std ::is_integral_v is undocumented

2021-06-29 Thread giecrilj at stegny dot 2a.pl via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101258

--- Comment #3 from Christopher Yeleighton  ---
It should at least be present on the API page.  The standard is not for
developers.

[Bug tree-optimization/101256] [12 Regression] Wrong code with -O3 since r12-1841-g9fe9c45ae33a2df7

2021-06-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101256

--- Comment #2 from Andrew Pinski  ---
I have a fix but I don't have a testcase really.
What is happening is value_replacement is happening but since the ssa_name that
is being used for replace_phi_edge_with_variable is not newly defined, we are
adding the range info from something which was conditionally defined.

To be able to make sure we are doing the range for a newly defined name, we
need to pass the sequence of statements that get moved/added before
conditional.

[Bug c/101265] New: C2X [[maybe_unused]] ignored when placed after array declaration

2021-06-29 Thread gcc at alanwu dot email via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101265

Bug ID: 101265
   Summary: C2X [[maybe_unused]] ignored when placed after array
declaration
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gcc at alanwu dot email
  Target Milestone: ---

With the following:

void foo(void) {
[[maybe_unused]] int thisworks[1];
int thisdoesnt[1] [[maybe_unused]];
}

GCC 11 warns:

$ gcc-11 -std=c2x -pedantic -Wall -c test.c
test.c: In function 'foo':
test.c:3:5: warning: 'maybe_unused' attribute ignored [-Wattributes]
3 | int thisdoesnt[1] [[maybe_unused]];
  | ^~~
test.c:3:9: warning: unused variable 'thisdoesnt' [-Wunused-variable]
3 | int thisdoesnt[1] [[maybe_unused]];
  | ^~

Is this a bug? I'm not familiar with the spec. By the way, `g++-11`
doesn't emit any warnings for the same file and `clang` seems to also accept
it.

gcc-11 -v:

COLLECT_GCC=gcc-11
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
11.1.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --disable-cet
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-11-2V7zgg/gcc-11-11.1.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-2V7zgg/gcc-11-11.1.0/debian/tmp-gcn/usr
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Ubuntu 11.1.0-1ubuntu1~20.04)

It seems to reproduce on trunk on Compiler Explorer:

gcc
(Compiler-Explorer-Build-gcc-7c6b354b92b38f31cd2399fbdbc9d6f837881480-binutils-2.36.1)
12.0.0 20210628 (experimental)

[Bug libstdc++/100823] Special member functions of common_iterator should be conditionally trivial

2021-06-29 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100823

Jonathan Wakely  changed:

   What|Removed |Added

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

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

Andrew Macleod  changed:

   What|Removed |Added

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

--- Comment #13 from Andrew Macleod  ---
Fix should be checked in.

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

--- Comment #12 from CVS Commits  ---
The master branch has been updated by Andrew Macleod :

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

commit r12-1916-ga96d8d67d0073a7031c0712bc3fb7759417b2125
Author: Andrew MacLeod 
Date:   Tue Jun 29 10:52:58 2021 -0400

Fix MINUS_EXPR relations.

Flesh out and correct relations for both wrapping and non-wrapping values.

gcc/
PR tree-optimization/101254
* range-op.cc (operator_minus::op1_op2_relation_effect): Check for
wrapping/non-wrapping when setting the result range.

gcc/testsuite
* gcc.dg/pr101254.c: New.

[Bug middle-end/101262] GCC11 OpenMP optimization causes sigsegv on aligned constant array in darktable

2021-06-29 Thread johnnybit at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101262

--- Comment #2 from Hubert Kowalski  ---
I've tried producing a minimum reproducer in form of code below, however I run
on gcc 10.3. And it depends on optimization type.

According to user reports - it's enough to compile darktable using GCC 11 with
RelWithDebInfo target (it applies -O2). Builds with Release target (-O3) are
apparently "fine"

(below code theoretically reproduces issue, but afaik it might not reliably
reproduce the problem)

#include 
#include 
#include 

#if defined(__GNUC__)
#pragma GCC optimize ("unroll-loops", "tree-loop-if-convert", \
  "tree-loop-distribution", "no-strict-aliasing", \
  "loop-interchange", "loop-nest-optimize", "tree-loop-im",
\
  "unswitch-loops", "tree-loop-ivcanon",
"ira-loop-pressure", \
  "split-ivs-in-unroller",
"variable-expansion-in-unroller", \
  "split-loops", "ivopts", "predictive-commoning",\
  "tree-loop-linear", "loop-block", "loop-strip-mine", \
  "finite-math-only", "fp-contract=fast", "fast-math")
#endif

#define dt_omp_firstprivate(...) firstprivate(__VA_ARGS__)
#define __DT_CLONE_TARGETS__ __attribute__((target_clones("default", "sse2",
"sse3", "sse4.1", "sse4.2", "popcnt", "avx", "avx2", "avx512f", "fma4")))
#define DT_ALIGNED_ARRAY __attribute__((aligned(64)))
#define PIXEL_CHAN 8
#define UI_SAMPLES 256

// radial distances used for pixel ops
static const float centers_ops[PIXEL_CHAN] DT_ALIGNED_ARRAY = {-56.0f / 7.0f,
// = -8.0f
   -48.0f / 7.0f,
   -40.0f / 7.0f,
   -32.0f / 7.0f,
   -24.0f / 7.0f,
   -16.0f / 7.0f,
-8.0f / 7.0f,
 0.0f / 7.0f};

typedef struct dt_iop_toneequalizer_gui_data_t
{
  // Mem arrays 64-bits aligned - contiguous memory
  float factors[PIXEL_CHAN] DT_ALIGNED_ARRAY;
  float gui_lut[UI_SAMPLES] DT_ALIGNED_ARRAY; // LUT for the UI graph
  float sigma;
} dt_iop_toneequalizer_gui_data_t;

#pragma omp declare simd
__DT_CLONE_TARGETS__
static inline float fast_clamp(const float value, const float bottom, const
float top)
{
  // vectorizable clamping between bottom and top values
  return fmaxf(fminf(value, top), bottom);
}

#pragma omp declare simd
__DT_CLONE_TARGETS__
static float gaussian_denom(const float sigma)
{
  // Gaussian function denominator such that y = exp(- radius^2 / denominator)
  // this is the constant factor of the exponential, so we don't need to
recompute it
  // for every single pixel
  return 2.0f * sigma * sigma;
}

#pragma omp declare simd
__DT_CLONE_TARGETS__
static float gaussian_func(const float radius, const float denominator)
{
  // Gaussian function without normalization
  // this is the variable part of the exponential
  // the denominator should be evaluated with `gaussian_denom`
  // ahead of the array loop for optimal performance
  return expf(- radius * radius / denominator);
}

__DT_CLONE_TARGETS__
static inline float pixel_correction(const float exposure,
 const float *const restrict factors,
 const float sigma)
{
  // build the correction for the current pixel
  // as the sum of the contribution of each luminance channel
  float result = 0.0f;
  const float gauss_denom = gaussian_denom(sigma);
  const float expo = fast_clamp(exposure, -8.0f, 0.0f);

#pragma omp simd aligned(centers_ops, factors:64) safelen(PIXEL_CHAN)
reduction(+:result)
  for(int i = 0; i < PIXEL_CHAN; ++i)
result += gaussian_func(expo - centers_ops[i], gauss_denom) * factors[i];

  return fast_clamp(result, 0.25f, 4.0f);
}

__DT_CLONE_TARGETS__
static inline void compute_lut_correction(struct
dt_iop_toneequalizer_gui_data_t *g,
  const float offset,
  const float scaling)
{
  // Compute the LUT of the exposure corrections in EV,
  // offset and scale it for display in GUI widget graph

  float *const restrict LUT = g->gui_lut;
  const float *const restrict factors = g->factors;
  const float sigma = g->sigma;

#pragma omp parallel for simd schedule(static) default(none) \
  dt_omp_firstprivate(factors, sigma, offset, scaling, LUT) \
  aligned(LUT, factors:64)
  for(int k = 0; k < UI_SAMPLES; k++)
  {
// build the inset graph curve LUT
// the x range is [-14;+2] EV
const float x = (8.0f * (((float)k) / ((float)(UI_SAMPLES - 1 - 8.0f;
LUT[k] = offset - log2f(pixel_correction(x, factors, sigma)) / scaling;
  }
}

int main() {

[Bug debug/101064] long compile time in var_tracking for Go package

2021-06-29 Thread ian at airs dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101064

--- Comment #5 from Ian Lance Taylor  ---
I have attached a C test case that demonstrates the problem.  The C case may be
somewhat worse because I had to use ordinary variables, whereas the Go test
case is used compiler-generated temporary variables.

When I compiled the C test case with mainline GCC with "-g -O2" on my laptop
the compilation takes 20 minutes, and according to -ftime-report 91% of that
time is spent on var-tracking:

 var-tracking dataflow  : 541.98 ( 44%)   0.02 (  2%) 542.26 ( 44%)
 1288k (  0%)
 var-tracking emit  : 575.86 ( 47%)   0.04 (  4%) 576.31 ( 47%)
 3125k (  0%)

This test case is, of course, generated code, as is the original Go test case
(the generated Go code is
https://go.googlesource.com/go/+/refs/heads/master/src/cmd/internal/obj/x86/avx_optabs.go).

The var-tracking pass already has a fast exit for functions with lots of basic
blocks.  Perhaps it also needs a fast exit for functions that are very long
even if they don't have many basic blocks.

[Bug debug/101064] long compile time in var_tracking for Go package

2021-06-29 Thread ian at airs dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101064

--- Comment #4 from Ian Lance Taylor  ---
Created attachment 51086
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51086=edit
C test case

[Bug debug/101064] long compile time in var_tracking for Go package

2021-06-29 Thread ian at airs dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101064

Ian Lance Taylor  changed:

   What|Removed |Added

 CC||ian at airs dot com

--- Comment #3 from Ian Lance Taylor  ---
I've committed fixes to the Go frontend that speed up this test case
significantly by generating fewer temporary variables.

[Bug middle-end/101264] [12 Regression] ICE in vect_optimize_slp, at tree-vect-slp.c:3880

2021-06-29 Thread burnus at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101264

Tobias Burnus  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org
   Target Milestone|--- |12.0
Summary|ICE in vect_optimize_slp,   |[12 Regression] ICE in
   |at tree-vect-slp.c:3880 |vect_optimize_slp, at
   ||tree-vect-slp.c:3880

--- Comment #1 from Tobias Burnus  ---
Culprit: r12-1872-g6df6055d5c666e669890ff8572df2353e341a534
Add forward propagation to SLP "any" permutes

Committed 5h ago ...

[Bug middle-end/101264] New: ICE in vect_optimize_slp, at tree-vect-slp.c:3880

2021-06-29 Thread burnus at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101264

Bug ID: 101264
   Summary: ICE in vect_optimize_slp, at tree-vect-slp.c:3880
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Created attachment 51085
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51085=edit
Compile with: gfortran -Ofast

The ICE occurs with compiling with
  gfortran -Ofast
or
  gfortran -O3 -ffast-math -fno-protect-parens



during GIMPLE pass: slp
foo2.f90:1:16:

1 |   SUBROUTINE foo (a,b,c,d,trigs,inc1,inc2,inc3,inc4,lot,n,la)
  |^
internal compiler error: in vect_optimize_slp, at tree-vect-slp.c:3880
0x789de1 vect_optimize_slp(vec_info*)
../../repos/gcc/gcc/tree-vect-slp.c:3880
0x1229de1 vect_optimize_slp(vec_info*)
../../repos/gcc/gcc/tree-vect-slp.c:5734
0x1229de1 vect_slp_analyze_bb_1
../../repos/gcc/gcc/tree-vect-slp.c:5698

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

--- Comment #11 from Andrew Macleod  ---
(In reply to Jakub Jelinek from comment #10)
> Comment on attachment 51084 [details]
> another patch
> 
> Except for some consistency (max is in comments lowercase, but MIN is
> uppercase), it looks good to me.

latest version i had already switched those to +INF and -INF terminology. 
Running thru testing now. 

> Slightly OT, wonder if something tries to handle even the swapped arguments,
> i.e. relation op1 < op2 and subtraction op2 - op1.  But that can be done
> incrementally if not done yet...

Not sure I follow.  Why would we be interested in swapping operands of a minus?

[Bug debug/101064] long compile time in var_tracking for Go package

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101064

--- Comment #2 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Ian Lance Taylor
:

https://gcc.gnu.org/g:528ed794016472a209d6cfaa921307f30eee58da

commit r11-8663-g528ed794016472a209d6cfaa921307f30eee58da
Author: Ian Lance Taylor 
Date:   Tue Jun 29 11:00:13 2021 -0700

compiler: in composite literals use temps only for interfaces

For a composite literal we only need to introduce a temporary variable
if we may be converting to an interface type, so only do it then.
This saves over 80% of compilation time when using gccgo to compile
cmd/internal/obj/x86, as the GCC middle-end spends a lot of time
pointlessly computing interactions between temporary variables.

For PR debug/101064
For golang/go#46600

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/331513

[Bug debug/101064] long compile time in var_tracking for Go package

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101064

--- Comment #1 from CVS Commits  ---
The master branch has been updated by Ian Lance Taylor :

https://gcc.gnu.org/g:8a8a7d332d5d01db5aea7336a36d9fd71a679fb1

commit r12-1913-g8a8a7d332d5d01db5aea7336a36d9fd71a679fb1
Author: Ian Lance Taylor 
Date:   Mon Jun 28 16:47:55 2021 -0700

compiler: in composite literals use temps only for interfaces

For a composite literal we only need to introduce a temporary variable
if we may be converting to an interface type, so only do it then.
This saves over 80% of compilation time when using gccgo to compile
cmd/internal/obj/x86, as the GCC middle-end spends a lot of time
pointlessly computing interactions between temporary variables.

For PR debug/101064
For golang/go#46600

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/331513

[Bug middle-end/101262] GCC11 OpenMP optimization causes sigsegv on aligned constant array in darktable

2021-06-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101262

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
 CC||jakub at gcc dot gnu.org
 Ever confirmed|0   |1
   Last reconfirmed||2021-06-29

--- Comment #1 from Jakub Jelinek  ---
Please provide a small self-contained testcase, the above can't be compiled.

[Bug target/101200] Unneeded AND after shift

2021-06-29 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101200

--- Comment #7 from Jeffrey A. Law  ---
FWIW, it might be worth considering using a mode iterator for the shift count
to allow multiple modes.

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

--- Comment #10 from Jakub Jelinek  ---
Comment on attachment 51084
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51084
another patch

Except for some consistency (max is in comments lowercase, but MIN is
uppercase), it looks good to me.
Slightly OT, wonder if something tries to handle even the swapped arguments,
i.e. relation op1 < op2 and subtraction op2 - op1.  But that can be done
incrementally if not done yet...

[Bug libstdc++/101263] New: non-propagating-cache::emplace-deref missing constexpr

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

Bug ID: 101263
   Summary: non-propagating-cache::emplace-deref missing constexpr
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

Hi, P2328R1 is marked as completed in https://gcc.gnu.org/wiki/LibstdcxxTodo,
but it seems that the constexpr keyword added by R1 has not been added in
libstdc++.

https://godbolt.org/z/d7r6cbTYj

[Bug tree-optimization/101256] [12 Regression] Wrong code with -O3 since r12-1841-g9fe9c45ae33a2df7

2021-06-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101256

Andrew Pinski  changed:

   What|Removed |Added

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

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

[Bug c/101262] New: GCC11 OpenMP optimization causes sigsegv on aligned constant array in darktable

2021-06-29 Thread johnnybit at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101262

Bug ID: 101262
   Summary: GCC11 OpenMP optimization causes sigsegv on aligned
constant array in darktable
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: johnnybit at gmail dot com
  Target Milestone: ---

A loop with constant length arrays with openmp and simd optimization crashes
with sigsegv when compilled with GCC11. Same code works with previous versions
and with various Clang versions

the code in question looks like

#define PIXEL_CHAN 8

static const float centers_ops[PIXEL_CHAN] DT_ALIGNED_ARRAY = {-56.0f / 7.0f,
// = -8.0f
   -48.0f / 7.0f,
   -40.0f / 7.0f,
   -32.0f / 7.0f,
   -24.0f / 7.0f,
   -16.0f / 7.0f,
-8.0f / 7.0f,
 0.0f / 7.0f};

#pragma omp simd aligned(centers_ops, factors:64) safelen(PIXEL_CHAN)
reduction(+:result)
  for(int i = 0; i < PIXEL_CHAN; ++i)
result += gaussian_func(expo - centers_ops[i], gauss_denom) * factors[i];


centers_ops is static const float [PIXEL_CHAN]
factors is const float *const restric factors (which is PIXEL_CHAN length)

the crash is on

result += gaussian_func(expo - centers_ops[i], gauss_denom) * factors[i];

line.

The reports in darktable are 
https://github.com/darktable-org/darktable/issues/9340
https://github.com/darktable-org/darktable/issues/9002

[Bug target/95046] Vectorize V2SFmode operations

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95046

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

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

commit r12-1912-gc60d9160b4d966dbea5b1bbea4f817c64d0bee2d
Author: Uros Bizjak 
Date:   Tue Jun 29 19:14:35 2021 +0200

i386: Add V2SFmode vec_addsub pattern [PR95046]

gcc/

2021-06-21  Uroš Bizjak  

PR target/95046
* config/i386/mmx.md (vec_addsubv2sf3): New insn pattern.

gcc/testsuite/

2021-06-21  Uroš Bizjak  

PR target/95046
* gcc.target/i386/pr95046-9.c: New test.

[Bug middle-end/101261] clones for target_clones attribute cannot be created when compilling with -fno-semantic-interposition

2021-06-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101261

--- Comment #1 from Andrew Pinski  ---
  if (node->definition
  && (node->alias || !tree_versionable_function_p (node->decl)))

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

Andrew Macleod  changed:

   What|Removed |Added

  Attachment #51083|0   |1
is obsolete||

--- Comment #9 from Andrew Macleod  ---
Created attachment 51084
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51084=edit
another patch

OK, fleshed it out.  Your observations about [0,max] for unsigned are true, but
it was harmless.  however, when I broke it into 3 cases, unsigned, wrapping
signed and nornmal signed, it looks like I can simply treat it as wrapping and
non-wrapping.. since ~[0,0]for unsigned is the same as [1, max]
anyway I added the LT, LE, and NE cases as well.

I think this is now right and complete?  or have I missed something else..
certainly possible,I'm developing a headache thinking about it.

[Bug debug/98776] DW_AT_low_pc is inconsistent with function entry address, when enabling -fpatchable-function-entry

2021-06-29 Thread luis.machado at linaro dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98776

Luis Machado  changed:

   What|Removed |Added

 CC||luis.machado at linaro dot org

--- Comment #2 from Luis Machado  ---
Confirmed on today's master (June 29th - 2021).

[Bug c/101261] New: clones for target_clones attribute cannot be created when compilling with -fno-semantic-interposition

2021-06-29 Thread johnnybit at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101261

Bug ID: 101261
   Summary: clones for target_clones attribute cannot be created
when compilling with -fno-semantic-interposition
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: johnnybit at gmail dot com
  Target Milestone: ---

darktable's user reported problem building darktable with "optimized" flags and
I could confirm the error is present on GCC 10.3.0

When compilling whole darktable with CFLAGS set to 
`-march=native -O3 -fno-semantic-interposition -flto=3 -fno-plt
-fgraphite-identity -floop-nest-optimize -fuse-linker-plugin -pipe -Wl,-O1
-Wl,--as-needed`

the compiler errors with:

src/common/iop_profile.c:1015:6: error: clones for «target_clones» attribute
cannot be created
 1015 | void dt_ioppr_transform_image_colorspace(struct dt_iop_module_t *self,
const float *const image_in,
  |  ^

I've managed to narrow it down and it was enough to just set the
-fno-semantic-interposition flag to make darktable compillation error out on
the same point.

I haven't been able to create minimum reproducer for this problem (single file
project compiles and runs ok)

for details please check https://github.com/darktable-org/darktable/issues/9303

[Bug libstdc++/101258] std ::is_integral_v is undocumented

2021-06-29 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101258

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||documentation

--- Comment #2 from Jonathan Wakely  ---
https://en.cppreference.com/w/cpp/types#Type_traits
https://en.cppreference.com/w/cpp/types/is_integral

[Bug libstdc++/101258] std ::is_integral_v is undocumented

2021-06-29 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101258

--- Comment #1 from Jonathan Wakely  ---
It does exactly what the standard says it does. And it's self explanatory.

[Bug rtl-optimization/100328] IRA doesn't model matching constraint well

2021-06-29 Thread rsandifo at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100328

--- Comment #7 from rsandifo at gcc dot gnu.org  
---
(In reply to Kewen Lin from comment #6)
> Created attachment 51066 [details]
> aarch64 XPASS failure list
> 
> The patch v3 bootstrapped and regression-tested on x86_64-redhat-linux and
> powerpc64le-linux-gnu, but still have some "XFAIL -> XPASS" regression
> failures on aarch64-linux-gnu, I think these remaining failures are expected
> (assembly gets improved). Need Richard's help to double check/confirm them.
Nice!  Yeah, these are all progressions rather than regressions.

The scan-assemblers in gcc.target/sve/acle check for the preferred output.
We don't always get there yet, so some of them have been XFAILed.  But for
this part of the testsuite all XFAILs->XPASSes are improvements.

[Bug target/65181] Support for alloca in nvptx

2021-06-29 Thread tschwinge at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65181

--- Comment #5 from Thomas Schwinge  ---
While reviewing other things, I found that "'alloca' is a preview feature in
PTX ISA version 7.3", and "requires 'sm_52' or higher".  That got published
2021-05, so it'll be a while until we can reliably use it, but we're getting
there...  ;-)

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

--- Comment #8 from Andrew Macleod  ---
I just never added them... I guess we could fully flesh out the combinations
and results.   Note this is also the only non-relational operand that is even
implemented so far..  Haven't gotten to any of the others yet.

[Bug c++/100975] [C++23] Allow pointer to array of auto

2021-06-29 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100975

Marek Polacek  changed:

   What|Removed |Added

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

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

--- Comment #7 from Jakub Jelinek  ---
BTW, rel of NE_EXPR, LE_EXPR or LT_EXPR never appear?  I guess one can always
swap the two operands and thus transform LE_EXPR into GE_EXPR and LT_EXPR into
GT_EXPR, but for EQ_EXPR vs. NE_EXPR that doesn't work.

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

--- Comment #6 from Jakub Jelinek  ---
Well, from x > y signed -fwrapv you can assume x - y to be ~[0, 0] (from x >= y
nothing).
It is similar to unsigned, though in that case there are no negative values and
so for x >= y x - y [0, max] is the actually VARYING and for x > y x - y [1,
max]  is the same thing as ~[0, 0].

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

Andrew Macleod  changed:

   What|Removed |Added

  Attachment #51082|0   |1
is obsolete||

--- Comment #5 from Andrew Macleod  ---
Created attachment 51083
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51083=edit
new patch

Ah right.  so op1 == op2 is the only time we can conclude anything.  Like so:

[Bug tree-optimization/101260] New: Backport 27381e78925 to GCC 11

2021-06-29 Thread stefansf at linux dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101260

Bug ID: 101260
   Summary: Backport 27381e78925 to GCC 11
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Keywords: wrong-code
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: stefansf at linux dot ibm.com
  Target Milestone: ---
Target: s390*-*-*

struct a {
  unsigned b : 7;
  int c;
  int d;
  short e;
} p, *q = 
int f, g, h, i, r, s;
static short j[8][1][6] = {};
char k[7];
short l, m;
int *n;
int **o = 
void t() {
  for (; f;)
;
}
static struct a u(int x) {
  struct a a = {4, 8, 5, 4};
  for (; i <= 6; i++) {
struct a v = {};
for (; l; l++)
  h = 0;
for (; h >= 0; h--) {
  j[i];
  struct a *w = 
  s = 0;
  for (; s < 3; s++) {
r ^= x;
m = j[i][g][h] == (k[g] = g);
*w = v;
  }
  r = 2;
  for (; r; r--)
*o = 
}
  }
  t();
  return a;
}
int main() {
  *q = u(636);
  if (p.b != 4)
__builtin_abort ();
}

The reduced example runs fine if compiled with mainline (currently 53fd7544aff)
whereas it fails if compiled with GCC 11 (currently f6306457ee3). The example
runs fine with GCC 11, too, if commit d1d01a66012a93cc8cb7dafbe1b5ec453ec96b59
is cherry picked. Can we backport this one?

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

--- Comment #4 from Jakub Jelinek  ---
Anyway, I think you just can't assume anything for the SIGNED &&
TYPE_OVERFLOW_WRAPS case, the result can be anything (VARYING) both for the
GT_EXPR and GE_EXPR.

[Bug target/96306] gcn libgomp build broken after "libomp: Add omp_depend_kind to omp_lib.{f90,h}"

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96306

--- Comment #13 from CVS Commits  ---
The master branch has been updated by Julian Brown :

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

commit r12-1911-gc0f8c22a3e9f8cd45c1cb4be5f83afbebe3bfdc9
Author: Julian Brown 
Date:   Fri Jun 11 14:44:36 2021 -0700

Fortran: Re-enable 128-bit integers for AMD GCN

This patch reverts the part of Tobias's patch for PR target/96306 that
disables 128-bit integer support for AMD GCN.

2021-06-18  Julian Brown  

libgfortran/
PR target/96306
* configure.ac: Remove stanza that removes KIND=16 integers for AMD
GCN.
* configure: Regenerate.

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

--- Comment #3 from Jakub Jelinek  ---
INT_MAX - INT_MIN with -fwrapv is -1, indeed, and generally if
x > y then x - y < 0 iff x > y + INT_MAX.
Say
x = 1073741839
y = -1073741887
x > y && x - y (== -2147483570) < 0

[Bug c++/99909] The value of 'std::is_integral_v' is not usable in a constant expression

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

--- Comment #2 from 康桓瑋  ---
(In reply to Christopher Yeleighton from comment #1)
> (In reply to 康桓瑋 from comment #0)
> > template  class>
> > constexpr auto f() {}
> 
> That means auto is void, doesn’t it?

Yes, the second auto just means void.

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

--- Comment #2 from Andrew Macleod  ---
Created attachment 51082
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51082=edit
patch

I *think* this is correct.   but wrapv and signed stuff sometimes confuses me
:-)
when -fwrapv is on,  +INf - -INF is -1 ?  is this correct?
in which case, the relations that were being added for minus were not quite
correct in this case.

givenlhs = op1 - op2
if op1 > op2, we were producing a range of [1, +INF].  which is fine for
unsigned.   but for signed, that edge condition for -INF means the range should
be [0, +INF].
likewise, if op1 >= op2, then result range would be [0, +INF]

Is this is correct?   I hope that  -INF - -INF still equals 0 tho?  Thats the
only other case that might need consideration.

The attached patch implements the above and appears to fix the test. I just
want to be sure I have it right.

[Bug modula2/101259] New: error: the file containing the definition module 'getopt' cannot be found

2021-06-29 Thread doko at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101259

Bug ID: 101259
   Summary: error: the file containing the definition module
'getopt' cannot be found
   Product: gcc
   Version: 10.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: modula2
  Assignee: unassigned at gcc dot gnu.org
  Reporter: doko at debian dot org
  Target Milestone: ---

seen with trunk 20210629, and trunk 20210629 of the gm2 repo, configured as a
normal bootstrap build:

/packages/gcc/snap/gcc-snapshot-20210629/src/libgm2/libm2pim/../../gcc/m2/gm2-libs/GetOpt.mod:213:11
: error: the file containing the definition module 'getopt' cannot be found
  213 | END GetOpt.
  |   ^
make[7]: *** [Makefile:950: GetOpt.lo] Error 1

That includes:

Author: Gaius Mulley 
Date:   Sun Jun 27 17:03:29 2021 +0100

* Makefile.am:  renamed getopt.c to cgetopt.c.
* Make-lang.in:  renamed getopt.c to cgetopt.c.

so what am I missing here?

[Bug other/67300] -foffload* undocumented

2021-06-29 Thread tschwinge at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67300

Thomas Schwinge  changed:

   What|Removed |Added

 Depends on|81886   |

--- Comment #6 from Thomas Schwinge  ---
(In reply to Tobias Burnus from comment #5)
> Done: -foffload= and new -foffload-options= are now documented.

Thanks for your work on this (which I have not yet reviewed, having just
returned from vacations).  ;-)

Should we get this (after some time) into the GCC 11 branch, to be able to fix
up the libgomp testcases there, too?


> To do: Still undocumented:
>   -foffload-abi=[lp64|ilp32]

Not sure if we really want to properly document that one: that's an internal
thing, not to be touched by users.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81886
[Bug 81886] Means to determine at runtime foffload targets specified at compile
time

[Bug libstdc++/101258] New: std ::is_integral_v is undocumented

2021-06-29 Thread giecrilj at stegny dot 2a.pl via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101258

Bug ID: 101258
   Summary: std ::is_integral_v is undocumented
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: giecrilj at stegny dot 2a.pl
  Target Milestone: ---

[Bug c++/99909] The value of 'std::is_integral_v' is not usable in a constant expression

2021-06-29 Thread giecrilj at stegny dot 2a.pl via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99909

Christopher Yeleighton  changed:

   What|Removed |Added

 CC||giecrilj at stegny dot 2a.pl

--- Comment #1 from Christopher Yeleighton  ---
(In reply to 康桓瑋 from comment #0)
> template  class>
> constexpr auto f() {}

That means auto is void, doesn’t it?

[Bug other/67300] -foffload* undocumented

2021-06-29 Thread burnus at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67300

--- Comment #5 from Tobias Burnus  ---
Done: -foffload= and new -foffload-options= are now documented.

To do: Still undocumented:
  -foffload-abi=[lp64|ilp32]

[Bug other/67300] -foffload* undocumented

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67300

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

https://gcc.gnu.org/g:33c4e466243f2d0459d9a4d0cadc1b38a3741f3e

commit r12-1871-g33c4e466243f2d0459d9a4d0cadc1b38a3741f3e
Author: Tobias Burnus 
Date:   Tue Jun 29 15:58:21 2021 +0200

Add 'default' to -foffload=; document that flag [PR67300]

As -foffload={options,targets,targets=options} is very convoluted,
it has been split into -foffload=targets (supporting the old syntax
for backward compatibilty) and -foffload-options={options,target=options}.

Only the new syntax is documented.

Additionally, -foffload=default is supported, which can reset the
devices after -foffload=disable / -foffload=targets to the default,
if needed.

gcc/ChangeLog:

PR other/67300
* common.opt (-foffload=): Update description.
(-foffload-options=): New.
* doc/invoke.texi (C Language Options): Document
-foffload and -foffload-options.
* gcc.c (check_offload_target_name): New, split off from
handle_foffload_option.
(check_foffload_target_names): New.
(handle_foffload_option): Handle -foffload=default.
(driver_handle_option): Update for -foffload-options.
* lto-opts.c (lto_write_options): Use -foffload-options
instead of -foffload.
* lto-wrapper.c (merge_and_complain, append_offload_options):
Likewise.
* opts.c (common_handle_option): Likewise.

libgomp/ChangeLog:

PR other/67300
* testsuite/libgomp.c-c++-common/reduction-16.c: Replace
-foffload=nvptx-none= by -foffload-options=nvptx-none= to
avoid disabling other offload targets.
* testsuite/libgomp.c-c++-common/reduction-5.c: Likewise.
* testsuite/libgomp.c-c++-common/reduction-6.c: Likewise.
* testsuite/libgomp.c/target-44.c: Likewise.

[Bug fortran/90742] OpenACC/OpenMP target offloading: Fortran 'allocatable' scalars in 'firstprivate' clauses

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90742

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

https://gcc.gnu.org/g:489c5dcf7b063000a5e223535eb425cf9748720a

commit r12-1870-g489c5dcf7b063000a5e223535eb425cf9748720a
Author: Tobias Burnus 
Date:   Tue Jun 29 15:50:23 2021 +0200

libgomp.fortran/defaultmap-8.f90: Fix non-shared memory handling

Disable some more parts of the test as firstprivate does not work yet
due to PR fortran/90742.

libgomp/
* testsuite/libgomp.fortran/defaultmap-8.f90 (bar): Determine
whether
target has shared memory and disable some scalar
pointer/allocatable
checks if not as firstprivate does not work.

[Bug c++/100752] [11 Regression] error: cannot call member function ‘void S::f()’ without object

2021-06-29 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100752

Marek Polacek  changed:

   What|Removed |Added

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

--- Comment #8 from Marek Polacek  ---
Fixed.

[Bug c++/100752] [11 Regression] error: cannot call member function ‘void S::f()’ without object

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100752

--- Comment #7 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Marek Polacek
:

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

commit r11-8662-g2cf8d3fc05737684a16fa080b0c0d24048da782b
Author: Marek Polacek 
Date:   Tue Jun 8 17:44:13 2021 -0400

c++: Failure to delay noexcept parsing with ptr-operator [PR100752]

We weren't passing 'flags' to the recursive call to cp_parser_declarator
in the ptr-operator case and as an effect, delayed parsing of noexcept
didn't work as advertised.  The following change passes more than just
CP_PARSER_FLAGS_DELAY_NOEXCEPT but that doesn't seem to break anything.

I'm now also passing member_p and static_p, as a consequence, two tests
needed small tweaks.

PR c++/100752

gcc/cp/ChangeLog:

* parser.c (cp_parser_declarator): Pass flags down to
cp_parser_declarator.  Also pass static_p/member_p.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/noexcept69.C: New test.
* g++.dg/parse/saved1.C: Adjust dg-error.
* g++.dg/template/crash50.C: Likewise.

(cherry picked from commit f9c80eb12c58126a94ad869380af5b88b752c06f)

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

Richard Biener  changed:

   What|Removed |Added

   Keywords||wrong-code
   Priority|P3  |P1

[Bug ipa/101257] [11/12 Regression] Maybe wrong code since IPA mod ref was introduced

2021-06-29 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101257

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |11.2
   Keywords||wrong-code

[Bug tree-optimization/101256] [12 Regression] Wrong code with -O3 since r12-1841-g9fe9c45ae33a2df7

2021-06-29 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101256

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |12.0

[Bug ipa/101257] New: [11/12 Regression] Maybe wrong code since IPA mod ref was introduced

2021-06-29 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101257

Bug ID: 101257
   Summary: [11/12 Regression] Maybe wrong code since IPA mod ref
was introduced
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marxin at gcc dot gnu.org
CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

It's likely caused by a violation of the strict aliasing rules, but I can't
verify that:

$ wget http://loop-aes.sourceforge.net/aespipe/aespipe-v2.4f.tar.bz2
$ cd aespipe-v2.4f/
$ export CFLAGS="-O2 -flto -flto-partition=one" && ./configure && make tests
...

./aespipe -v -p 3 -e AES128 -K ./gpgkey2.asc -G test-dir1 test-file1 3test-file2
echo "f9825b79873f5c439ae9371c1a929a6c  test-file1" >test-file5
make[2]: Leaving directory '/tmp/aespipe-v2.4f'
cmp test-file2 test-file5
test-file2 test-file5 differ: byte 1, line 1
make[1]: *** [Makefile:120: test-part2] Error 1
make[1]: Leaving directory '/tmp/aespipe-v2.4f'
make: *** [Makefile:87: tests] Error 2

Adding -fno-strict-aliasing fixes that. And the following dbg counter shows
that:

$ gcc  -o aespipe aespipe.o aes.o md5.o sha512.o rmd160.o
-fdbg-cnt=ipa_mod_ref:385-385 -flto-partition=one
-fdump-tree-optimized-lineno=bad -fdump-ipa-modref-details && make tests

optimized dump diff is then:


;; Function compute_sector_iv (compute_sector_iv, funcdef_no=0, decl_uid=4504,
cgraph_uid=12, symbol_order=57)
...

   [./aespipe.c:775:20] _13 = MEM[(u_int64_t *)bfp_22 + 16B];
   [./aespipe.c:775:26] _14 = MEM[(u_int64_t *)bfp_22];
   [./aespipe.c:775:20] _15 = _13 ^ _14;
   [./aespipe.c:775:20] MEM[(u_int64_t *)bfp_22 + 16B] = _15;
   [./aespipe.c:776:20] _16 = MEM[(u_int64_t *)bfp_22 + 24B];
-  [./aespipe.c:776:26] _17 = MEM[(u_int64_t *)bfp_22 + 8B];
-  [./aespipe.c:776:20] _18 = _16 ^ _17;
+  [./aespipe.c:776:20] _18 = _12 ^ _16;
   [./aespipe.c:776:20] MEM[(u_int64_t *)bfp_22 + 24B] = _18;

So one load is optimized out

   769  do {
   770  bfp[0] ^= dip[0];
   771  bfp[1] ^= dip[1];
   772  aes_encrypt(acpa[0], (unsigned char *)bfp, (unsigned char
*)bfp);
   773  dip = bfp;
   774  bfp += 2;
   775  bfp[0] ^= dip[0];
   776  bfp[1] ^= dip[1];
   777  aes_encrypt(acpa[0], (unsigned char *)bfp, (unsigned char
*)bfp);
   778  dip = bfp;
   779  bfp += 2;
   780  } while(--x >= 0);
   781  size -= 512;

@Honza: Can you please take a look?

[Bug tree-optimization/101256] [12 Regression] Wrong code with -O3 since r12-1841-g9fe9c45ae33a2df7

2021-06-29 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101256

Martin Liška  changed:

   What|Removed |Added

  Known to work||11.1.0
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-06-29
  Known to fail||12.0
 Ever confirmed|0   |1

[Bug tree-optimization/101256] New: [12 Regression] Wrong code with -O3 since r12-1841-g9fe9c45ae33a2df7

2021-06-29 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101256

Bug ID: 101256
   Summary: [12 Regression] Wrong code with -O3 since
r12-1841-g9fe9c45ae33a2df7
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: wrong-code
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marxin at gcc dot gnu.org
CC: pinskia at gcc dot gnu.org
  Target Milestone: ---

Created attachment 51081
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51081=edit
test-case

It's a yarpgen test case and it's not easily reducible.

However, with the following patch:


diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def
index 93e7b4fd30e..6186b5533ca 100644
--- a/gcc/dbgcnt.def
+++ b/gcc/dbgcnt.def
@@ -158,6 +158,7 @@ DEBUG_COUNTER (dom_unreachable_edges)
 DEBUG_COUNTER (dse)
 DEBUG_COUNTER (dse1)
 DEBUG_COUNTER (dse2)
+DEBUG_COUNTER (edge_range)
 DEBUG_COUNTER (gcse2_delete)
 DEBUG_COUNTER (gimple_unroll)
 DEBUG_COUNTER (global_alloc_at_func)
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index ab12e85569d..21741504038 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-fold.h"
 #include "internal-fn.h"
 #include "gimple-range.h"
+#include "dbgcnt.h"

 static unsigned int tree_ssa_phiopt_worker (bool, bool, bool);
 static bool two_value_replacement (basic_block, basic_block, edge, gphi *,
@@ -413,7 +414,8 @@ replace_phi_edge_with_variable (basic_block cond_block,
   && EDGE_COUNT (gimple_bb (phi)->preds) == 2
   && INTEGRAL_TYPE_P (TREE_TYPE (phi_result))
   && !SSA_NAME_RANGE_INFO (new_tree)
-  && SSA_NAME_RANGE_INFO (phi_result))
+  && SSA_NAME_RANGE_INFO (phi_result)
+  && dbg_cnt(edge_range))
 duplicate_ssa_name_range_info (new_tree,
   SSA_NAME_RANGE_TYPE (phi_result),
   SSA_NAME_RANGE_INFO (phi_result));

One can reduce it to:

$ g++ driver.cpp -c && g++ func.cpp -O3 -c -fdbg-cnt=edge_range:52-52 && gcc
func.o driver.o && ./a.out
***dbgcnt: lower limit 52 reached for edge_range.***
***dbgcnt: upper limit 52 reached for edge_range.***
a.out: driver.cpp:3609: void checksum(): Assertion `var_303 == (unsigned
char)240' failed.
Aborted (core dumped)

[Bug fortran/101255] New: FLUSH statement - error should be negative

2021-06-29 Thread burnus at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101255

Bug ID: 101255
   Summary: FLUSH statement - error should be negative
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: wrong-code
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

F2018 states:

"Fortran 2008 specifies that the IOSTAT= variable shall be set to a
processor-dependent negative value if the flush operation is not supported for
the unit specified. This document specifies that the processor-dependent
negative27integer value shall be different from the named constants IOSTAT_EOR
or IOSTAT_END from the intrinsic28module ISO_FORTRAN_ENV."

However, the following program prints:
5002 Specified UNIT in FLUSH is not connected  
  -2  -1
shouldn't the 5002 be a negative number (such as -5002)?

use iso_fortran_env
implicit none
character(len=50) :: err
integer :: i
!open(99)
!close(99)
flush(99,iostat=i,iomsg=err)
print *, i, err
print *, IOSTAT_EOR , IOSTAT_END 
end

[Bug rtl-optimization/101044] -ABS(A) produces two neg instructions

2021-06-29 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101044

--- Comment #3 from Uroš Bizjak  ---
The compound nabs insn also needs to be handled in the STV pass.

[Bug c++/101210] [9/10/11 regression] spurious "reference binding to misaligned address" ubsan error for integer comparison

2021-06-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101210

Jakub Jelinek  changed:

   What|Removed |Added

Summary|[9/10/11/12 regression] |[9/10/11 regression]
   |spurious "reference binding |spurious "reference binding
   |to misaligned address"  |to misaligned address"
   |ubsan error for integer |ubsan error for integer
   |comparison  |comparison

--- Comment #7 from Jakub Jelinek  ---
Fixed on the trunk so far.

[Bug rtl-optimization/101044] -ABS(A) produces two neg instructions

2021-06-29 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101044

Uroš Bizjak  changed:

   What|Removed |Added

   Last reconfirmed||2021-06-29
 Ever confirmed|0   |1
   Assignee|unassigned at gcc dot gnu.org  |ubizjak at gmail dot com
 Status|UNCONFIRMED |ASSIGNED

--- Comment #2 from Uroš Bizjak  ---
Created attachment 51080
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51080=edit
Proposed patch

Patch introduces nabs patterns where we reverse the condition of the cmove.

The compilation results in:

movl%edi, %eax
negl%eax
cmovns  %edi, %eax

[Bug tree-optimization/101254] [12 Regression] gcc head does not comply fully to -fwrapv since r12-1723

2021-06-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

Jakub Jelinek  changed:

   What|Removed |Added

Summary|gcc head does not comply|[12 Regression] gcc head
   |fully to -fwrapv|does not comply fully to
   ||-fwrapv since r12-1723
 CC||aldyh at gcc dot gnu.org,
   ||amacleod at redhat dot com,
   ||jakub at gcc dot gnu.org
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-06-29
  Component|c   |tree-optimization
   Target Milestone|--- |12.0
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
Started with r12-1723-gae6b830f31a47aca7ca24c4fea245c29214eef3a
Adjusted testcase for testsuite:
/* PR tree-optimization/101254 */
/* { dg-do run } */
/* { dg-options "-O2 -fwrapv" } */

int
foo (long long imin, long long imax)
{
  if (imin > imax)
return 0;
  else if (imax - imin < 0 || (imax - imin) + 1 < 0)
return 0;
  return 1;
}

int
main ()
{
  long long imax = __LONG_LONG_MAX__;
  long long imin = -imax - 1; 
  if (!foo (-10, 10))
__builtin_abort ();
  if (foo (-10, imax))
__builtin_abort ();
  if (foo (imin, imax))
__builtin_abort ();
  return 0;
}

[Bug c++/101210] [9/10/11/12 regression] spurious "reference binding to misaligned address" ubsan error for integer comparison

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101210

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

https://gcc.gnu.org/g:53fd7544aff6d0a18869017cb9bb921a7f5dcd04

commit r12-1867-g53fd7544aff6d0a18869017cb9bb921a7f5dcd04
Author: Jakub Jelinek 
Date:   Tue Jun 29 11:24:38 2021 +0200

match.pd: Avoid (intptr_t)x eq/ne CST to x eq/ne (typeof x) CST opt in
GENERIC when sanitizing [PR101210]

When we have (intptr_t) x == cst where x has REFERENCE_TYPE, this
optimization creates x == cst out of it where cst has REFERENCE_TYPE.
If it is done in GENERIC folding, it can results in ubsan failures
where the INTEGER_CST with REFERENCE_TYPE is instrumented.

Fixed by deferring it to GIMPLE folding in this case.

2021-06-29  Jakub Jelinek  

PR c++/101210
* match.pd ((intptr_t)x eq/ne CST to x eq/ne (typeof x) CST): Don't
perform the optimization in GENERIC when sanitizing and x has a
reference type.

* g++.dg/ubsan/pr101210.C: New test.

[Bug c/101254] New: gcc head does not comply fully to -fwrapv

2021-06-29 Thread bugzilla.gnu at coelho dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254

Bug ID: 101254
   Summary: gcc head does not comply fully to -fwrapv
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bugzilla.gnu at coelho dot net
  Target Milestone: ---

Created attachment 51079
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51079=edit
source file for above test

-fwrapv does not work as expected on gcc head:

Previous expected behavior :

  sh> gcc --version
  gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

  sh> gcc -O2 -fwrapv gcc_overflow.c 
  sh> ./a.out 
  1: 1
  0: 0
  0: 0

Behavior with head:

  sh> gcc --version
  gcc (GCC) 12.0.0 20210627 (461f937b)

  sh> gcc -O2 -fwrapv gcc_overflow.c 
  sh> ./a.out
  1: 1
  0: 0
  0: 1

But with the same :

  sh> gcc -O1 -fwrapv gcc_overflow.c 
  sh> ./a.out
  1: 1
  0: 0
  0: 0

Not that it seems that it was working fine with bc046a60 on 2021-06-18, so the
regression may have been introduced after this date.

[Bug ada/100488] [12 Regression] trunk 20210508 fails to build ada on x86_64-linux-gnux32

2021-06-29 Thread ebotcazou at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100488

--- Comment #3 from Eric Botcazou  ---
Can you retry with current trunk?  There have been several fixes.

[Bug libstdc++/100017] [11/12 regression] error: 'fenv_t' has not been declared in '::' -- cross toolchain fails to build

2021-06-29 Thread davem at devkitpro dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017

--- Comment #17 from Dave Murphy  ---
(In reply to Jonathan Wakely from comment #16)
> I don't think the patch is sufficient, I think I had a complete one.

Shall I leave this or submit the patch I made as a starting point for review?

[Bug middle-end/101253] New: Optimize i % C1 == C0 || i % C1*C2 == C0 to i % C1 == C0

2021-06-29 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101253

Bug ID: 101253
   Summary: Optimize i % C1 == C0 || i % C1*C2 == C0 to i % C1 ==
C0
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: antoshkka at gmail dot com
  Target Milestone: ---

Consider the following code

bool test_naive(short i) {
return i % 100 == 0 || i % 400 == 0;
}

It could be optimized into

bool test_optim(short i) {
return i % 100 == 0;
}


Godbolt playground: https://godbolt.org/z/zW49qcs7G

P.S.: Inspired by the manual optimizations in libstdc++
https://github.com/gcc-mirror/gcc/commit/b92d12d3fe3f1aa56d190d960e40c62869a6cfbb

[Bug middle-end/101252] New: Optimize (b ? i % C0 : i % C1) into i & (b ? C0-1 : C1-1) for power of 2 C0 and C1

2021-06-29 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101252

Bug ID: 101252
   Summary: Optimize (b ? i % C0 : i % C1) into i & (b ? C0-1 :
C1-1) for power of 2 C0 and C1
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: antoshkka at gmail dot com
  Target Milestone: ---

Consider the following code

bool test_naive0(bool b, short i) {
return (b ? i % 4 : i % 16)==0;
}

It could be optimized into

bool test_optim0(bool b, short i) {
return (i & (b ? 15 : 3))==0;
}


Godbolt playground: https://godbolt.org/z/8vj999M3c

P.S.: Inspired by the manual optimizations in libstdc++
https://github.com/gcc-mirror/gcc/commit/b92d12d3fe3f1aa56d190d960e40c62869a6cfbb

[Bug middle-end/101251] New: Optimize i % (b ? C0 : C1) into i & (b ? C0-1 : C1-1) for power of 2 C0 and C1

2021-06-29 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101251

Bug ID: 101251
   Summary: Optimize i % (b ? C0 : C1) into i & (b ? C0-1 : C1-1)
for power of 2 C0 and C1
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: antoshkka at gmail dot com
  Target Milestone: ---

Consider the following code

bool test_optim01(bool b, short i) {
return i % (b ? 4 : 16)==0;
}

It could be optimized into

bool test_optim0(bool b, short i) {
return (i & (b ? 15 : 3))==0;
}


Godbolt playground: https://godbolt.org/z/j15br4Kd4

P.S.: Inspired by the manual optimizations in libstdc++
https://github.com/gcc-mirror/gcc/commit/b92d12d3fe3f1aa56d190d960e40c62869a6cfbb

[Bug middle-end/101250] New: adjust_iv_update_pos update the iv statement unexpectedly cause memory address offset mismatch

2021-06-29 Thread luoxhu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101250

Bug ID: 101250
   Summary: adjust_iv_update_pos update the iv statement
unexpectedly cause memory address offset mismatch
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: luoxhu at gcc dot gnu.org
  Target Milestone: ---

Test case:

unsigned int foo (unsigned char *ip, unsigned char *ref, unsigned int maxlen)
{
  unsigned int len = 2;
  do {
  len++;
  }while(len < maxlen && ip[len] == ref[len]);
  return len;
}


ivopts:

   [local count: 1014686026]:
  _3 = MEM[(unsigned char *)ip_10(D) + ivtmp.16_15 * 1];
  ivtmp.16_16 = ivtmp.16_15 + 1;
  _19 = ref_12(D) + 18446744073709551615;
  _6 = MEM[(unsigned char *)_19 + ivtmp.16_16 * 1];
  if (_3 == _6)
goto ; [94.50%]
  else
goto ; [5.50%]

Disable adjust_iv_update_pos will produce:

   [local count: 1014686026]:
  _3 = MEM[(unsigned char *)ip_10(D) + ivtmp.16_15 * 1];
  _6 = MEM[(unsigned char *)ref_12(D) + ivtmp.16_15 * 1];
  ivtmp.16_16 = ivtmp.16_15 + 1;
  if (_3 == _6)
goto ; [94.50%]
  else
goto ; [5.50%]


discussions:
https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573709.html

[Bug tree-optimization/101242] Segfault in SLP vectorizor after g:2ad71efb5de

2021-06-29 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101242

Richard Biener  changed:

   What|Removed |Added

 CC||suochenyao at 163 dot com

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

[Bug tree-optimization/101249] ICE: Segmentation fault with "-O3 -fno-tree-ch -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-strict-aliasing -fwrapv"

2021-06-29 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101249

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #2 from Richard Biener  ---
dup indeed.

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

[Bug tree-optimization/101242] Segfault in SLP vectorizor after g:2ad71efb5de

2021-06-29 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101242

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #8 from Richard Biener  ---
Fixed.

[Bug tree-optimization/101242] Segfault in SLP vectorizor after g:2ad71efb5de

2021-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101242

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Richard Biener :

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

commit r12-1866-gc01760bc548ba79bc9ac15168b27fe7aabcb19ae
Author: Richard Biener 
Date:   Tue Jun 29 09:33:24 2021 +0200

tree-optimization/101242 - fix reverse graph entry detection

This avoids detecting random unrelated nodes as possible entries
to not backwards reachable regions of the SLP graph.  Instead
explicitely add the problematic nodes.

This temporary XFAILs gcc.dg/vect/pr67790.c until I get the
permute propagation adjusted to when it needs more than one
optimistic iteration.

2021-06-29  Richard Biener  

PR tree-optimization/101242
* tree-vect-slp.c (vect_slp_build_vertices): Force-add
PHIs with not represented initial values as leafs.

* gcc.dg/vect/bb-slp-pr101242.c: New testcase.
* gcc.dg/vect/pr67790.c: XFAIL scan for zero VEC_PERM_EXPR.

[Bug driver/101238] Driver won't find cc1/cc1plus on MinGW, CXXFLAGS need -D__USE_MINGW_ACCESS

2021-06-29 Thread tomas.kalibera at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101238

--- Comment #2 from Tomas Kalibera  ---
I started writing that email, but on the way I found that one should add
-D__USE_MINGW_ACCESS also BOOT_CXXFLAGS, which I have neither done nor tested.
The problem I debugged required only required adding to CXXFLAGS.

In principle, one needs to add -D__USE_MINGW_ACCESS everywhere, where GCC might
use "access()" to query X_OK, so it should be safe to add simply everywhere
when compiling C or C++, it just must have been forgotten.

I see -D__USE_MINGW_ACCESS has been added to CXXFLAGS and BOOT_CXXFLAGS in GCC
11 by a patch from Martin Storsjo, "mh-mingw: Set __USE_MINGW_ACCESS in missed
C++ flags variables",
https://gcc.gnu.org/pipermail/gcc-patches/2021-April/567815.html

And it is related to "[MinGW] Set __USE_MINGW_ACCESS for C++ as well"
https://gcc.gnu.org/pipermail/gcc-patches/2019-March/518147.html
(done also in GCC 10), which adds __USE_MINGW_ACCESS to STAGE*_CXXFLAGS.

My testing was using an MXE-based build of GCC 10.2 (cross-compiled on Linux,
for 64-bit Windows, with MinGW-w64 7). Without the change, gcc.exe did not find
cc1.exe. Process monitor showed that gcc.exe called stat on cc1.exe
successfully (so used the correct path already the first time), but then
continued checking other locations and when it failed, tried to execute without
path name (relying on system PATH). So a workaround I have been using was to
have also cc1.exe on PATH, where it would be found by Windows (so the problem
of access(,X_OK) did not apply there).

Then the observed behavior matched the code of the driver gcc.c, which calls
access(,X_OK) to check that cc1.exe is executable, and it incorrectly concludes
that it isn't. Which in turn is because access on Windows does not support X_OK
(and __USE_MINGW_ACCESS provides a MinGW replacement which does). I've
confirmed this was what happened via adding print statements to the driver and
rebuilding. And eventually I rebuilt gcc with the proposed patch and it found
cc1.exe fine.

Should I still send a copy of Martin Storsjo's patch to
gcc-patc...@gcc.gnu.org, or is this information here now sufficient?

[Bug libstdc++/100017] [11/12 regression] error: 'fenv_t' has not been declared in '::' -- cross toolchain fails to build

2021-06-29 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017

--- Comment #16 from Jonathan Wakely  ---
I don't think the patch is sufficient, I think I had a complete one.

[Bug tree-optimization/101249] ICE: Segmentation fault with "-O3 -fno-tree-ch -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-strict-aliasing -fwrapv"

2021-06-29 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101249

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org,
   ||rguenth at gcc dot gnu.org
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-06-29
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Very likely dup of PR101242. Started with the same revision.

[Bug c++/101247] ICE when using static constexpr bool defined in base-class in derived class constructor requires-clause

2021-06-29 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101247

Martin Liška  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org
   Last reconfirmed||2021-06-29
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #1 from Martin Liška  ---
Confirmed, started with r10-3735-gcb57504a55015891.

[Bug tree-optimization/101249] New: ICE: Segmentation fault with "-O3 -fno-tree-ch -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-strict-aliasing -fwrapv"

2021-06-29 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101249

Bug ID: 101249
   Summary: ICE: Segmentation fault with "-O3 -fno-tree-ch
-fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse
-fno-strict-aliasing -fwrapv"
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
unsigned a[];
char b=0, c=0;
int d=0;
void e() {
  int f, g;
  for (; b; b++) {
c = 0;
for (; c <= 8; c++) {
  int *h = 
  *h |= a[c];
  g = *h = a[c];
}
d = g;
  }
}
int main() {}
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data/bin/gcc-dev --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210628 (experimental) (GCC)

git version: 7c6b354b92b38f31cd2399fbdbc9d6f837881480
***
Command Lines:
$ gcc -O3 -fno-tree-ch -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse
-fno-strict-aliasing -fwrapv a.c
a.c:1:10: warning: array ‘a’ assumed to have one element
1 | unsigned a[];
  |  ^
a.c: In function ‘e’:
a.c:10:14: warning: iteration 1 invokes undefined behavior
[-Waggressive-loop-optimizations]
   10 |   *h |= a[c];
  | ~^~~
a.c:8:14: note: within this loop
8 | for (; c <= 8; c++) {
  |~~^~~~
during GIMPLE pass: slp
a.c:4:6: internal compiler error: Segmentation fault
4 | void e() {
  |  ^
0xe3a99f crash_signal
../../gcc/toplev.c:328
0x10e1b47 vec<_stmt_vec_info*, va_heap, vl_ptr>::iterate(unsigned int,
_stmt_vec_info**) const
../../gcc/vec.h:1697
0x10e1b47 vect_optimize_slp(vec_info*)
../../gcc/tree-vect-slp.c:3992
0x10e9c5c vect_optimize_slp(vec_info*)
../../gcc/vec.h:1448
0x10e9c5c vect_slp_analyze_bb_1
../../gcc/tree-vect-slp.c:5621
0x10e9c5c vect_slp_region
../../gcc/tree-vect-slp.c:5708
0x10eb2c8 vect_slp_bbs
../../gcc/tree-vect-slp.c:5858
0x10eb6c4 vect_slp_function(function*)
../../gcc/tree-vect-slp.c:5944
0x10f1712 execute
../../gcc/tree-vectorizer.c:1445
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug tree-optimization/101242] Segfault in SLP vectorizor after g:2ad71efb5de

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

--- Comment #6 from David Binderman  ---
(In reply to David Binderman from comment #4)
> Created attachment 51078 [details]
> gzipped C++ source code
> 
> I also see this with -O3 with the attached C++ code.

Poor example - too big to reduce easily. Here is some reduced
C code from a different example:

--- /home/dcb/cvise/test/bug733b.c ---
typedef struct {
  int height, width
} ufraw_image_data;
typedef struct {
  ufraw_image_data thumb
} ufraw_data;
ufraw_data ufraw_convert_embedded_uf;
int ufraw_convert_embedded_uf_1;
void ufraw_convert_embedded(void) {
  unsigned srcHeight = ufraw_convert_embedded_uf.thumb.height,
   srcWidth = ufraw_convert_embedded_uf.thumb.width;
  int scaleDenom = 1;
  srcSize();
  if (ufraw_convert_embedded_uf_1)
scaleDenom = srcSize;
  unsigned dstWidth = srcWidth / scaleDenom;
  unsigned dstHeight = srcHeight / scaleDenom;
  if (dstWidth != srcWidth || dstHeight != srcHeight) {
unsigned width = dstHeight;
dstHeight = dstWidth;
dstWidth = width;
  }
  ufraw_convert_embedded_uf.thumb.height = dstHeight;
  ufraw_convert_embedded_uf.thumb.width = dstWidth;
}

[Bug tree-optimization/101242] Segfault in SLP vectorizor after g:2ad71efb5de

2021-06-29 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101242

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #5 from Richard Biener  ---
Mine.

[Bug tree-optimization/101240] [missed optimization] Transitivity of less-than and less-or-equal

2021-06-29 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101240

--- Comment #2 from Richard Biener  ---
Note will require a VRP pass after PRE since only there we'll be able to
CSE the a[2] load.

[Bug tree-optimization/101240] [missed optimization] Transitivity of less-than and less-or-equal

2021-06-29 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101240

Richard Biener  changed:

   What|Removed |Added

 Blocks||85316
   Last reconfirmed||2021-06-29
 CC||amacleod at redhat dot com
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
EVRP sees

   :
  _1 = (*a_8(D))[0];
  _2 = (*a_8(D))[1];
  if (_1 < _2)
goto ; [INV]
  else
goto ; [INV]

   :
  _4 = (*a_8(D))[2];
  if (_2 < _4)
goto ; [INV]
  else
goto ; [INV]

   :
  __builtin_unreachable ();

   :
  _6 = (*a_8(D))[2];
  _9 = _1 < _6;

so predicate analysis should handle this (but it does not).  Btw, I fixed
the testcase for you:

#define ALWAYS_TRUE(x) do { if (x) __builtin_unreachable(); } while (false)
bool test_array(unsigned ()[3]) {
  ALWAYS_TRUE(a[0] < a[1] && a[1] < a[2]);
  return a[0] < a[2];
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases

[Bug driver/101238] Driver won't find cc1/cc1plus on MinGW, CXXFLAGS need -D__USE_MINGW_ACCESS

2021-06-29 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101238

Richard Biener  changed:

   What|Removed |Added

   Host||mingw

--- Comment #1 from Richard Biener  ---
Can you please post the patch to gcc-patc...@gcc.gnu.org stating how you tested
it?  Also see https://gcc.gnu.org/contribute.html - thanks.

[Bug tree-optimization/98602] Failure to optimise vector “x > -100 ? x : -100” to MAX_EXPR

2021-06-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98602

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #4 from Andrew Pinski  ---
Actually I am not going to handle this as the important parts of
fold_cond_expr_with_comparison have been ported already to match.pd.
But need extending for vector cases.

[Bug tree-optimization/98602] Failure to optimise vector “x > -100 ? x : -100” to MAX_EXPR

2021-06-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98602

Andrew Pinski  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
   Severity|normal  |enhancement
 CC||pinskia at gcc dot gnu.org
 Status|NEW |ASSIGNED

--- Comment #3 from Andrew Pinski  ---
I might get to this one when I move minmax_replacement from phiopt to match.pd.