[Bug tree-optimization/104269] [12 Regression] Bogus -Wuse-after-free seen in xen

2022-01-30 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104269

--- Comment #3 from Richard Biener  ---
The easiest would be to run _before_ uncprop.  uncprop is really part of
out-of-SSA to reduce the number of copies on edges (maybe it should be merged
into it instead of being visible as separate pass).

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

2022-01-30 Thread rdapp at linux dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104153

--- Comment #5 from rdapp at linux dot ibm.com ---
I would speculate that some of the FAILs are due to the same problem seen in
the other PR (104198), i.e. that for the second seq I wrongly assumed that the
backend does not recreate the original comparison as well as not read from
possibly overwritten regs.
Regarding the test failures - in case you don't have anything yet, I could 
build a vanilla and a patched cross compiler and look and the differences for
some of them.

[Bug rtl-optimization/104198] [12 regression] ifcvt change breaks 64-bit SPARC bootstrap

2022-01-30 Thread rdapp at linux dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104198

--- Comment #13 from rdapp at linux dot ibm.com ---
I was away for some days, going to look into this again today.

[Bug tree-optimization/104297] New: MIN_EXPR is not detected for a >= -__INT_MAX__ ? -__INT_MAX__ : a

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104297

Bug ID: 104297
   Summary: MIN_EXPR is not detected for a >= -__INT_MAX__  ?
-__INT_MAX__  : a
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: enhancement
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
int t(int a)
{
int b = -__INT_MAX__ ;
int c = a >= b ? b : a;
return c;
}

int t1(int a)
{
int c = a >= -__INT_MAX__  ? -__INT_MAX__  : a;
return c;
}

--- CUT ---
t1 should be detected to MIN_EXPR ;

[Bug c++/103341] [11 Regression] ICE type of variable instantiation constrained on template parameter

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

--- Comment #6 from Arseny Solokha  ---
g++ 12.0.1 20220130 snapshot (g:baf98320ac6cd56da0c0b460fb94e3b87a79220d) still
ICEs on the testcase in comment 3.

[Bug middle-end/104296] New: MIN should simplify to unsigned != 0

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104296

Bug ID: 104296
   Summary: MIN should simplify to unsigned != 0
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: enhancement
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
unsigned t(unsigned a)
{
unsigned b = 1;
return a >= b ? b : a;
}

unsigned t1(unsigned a)
{
return a >= 1 ? 1 : a;
}

These two functions are the same but currently they do not optimize to the same
thing.

[Bug c++/98675] Accessing member of temporary outside its lifetime allowed in constexpr function

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98675

--- Comment #4 from Andrew Pinski  ---
(In reply to Tobias Schlüter from comment #3)
> Sorry, in my example, I think actually clang is wrong.

What is the order of destruction of tempories here in the following statement:
A() << 1

Is A() destoryed before the temp B that is returned from operator <<.

Note MSVC accepts the code so it might be a bug in clang.

[Bug c++/98675] Accessing member of temporary outside its lifetime allowed in constexpr function

2022-01-30 Thread tobi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98675

--- Comment #3 from Tobias Schlüter  ---
Sorry, in my example, I think actually clang is wrong.

[Bug c++/98675] Accessing member of temporary outside its lifetime allowed in constexpr function

2022-01-30 Thread tobi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98675

Tobias Schlüter  changed:

   What|Removed |Added

 CC||tobi at gcc dot gnu.org

--- Comment #2 from Tobias Schlüter  ---
Here's another testcase (derived from code in the Eigen library ) that seems to
illustrate the same issue. Please follow the compiler explorer link to see a
non-constexpr version and its gimple that makes clear that there indeed is a
lifetime issue and also clang's error message https://godbolt.org/z/4zoKaoKa5

struct B;

#define CONSTEXPR constexpr
#define CONSTEVAL consteval

struct A {
public:
CONSTEXPR A() { m_val = 1; }
CONSTEXPR A(const A& other) { m_val = other.m_val;}
CONSTEXPR ~A() {};

CONSTEXPR int val() { return m_val; }

int m_val;

CONSTEXPR B operator<<(int);
};

struct B {
A& m_a;
CONSTEXPR B(A& ref) : m_a(ref) {}
CONSTEXPR B& operator,(int i) { m_a.m_val = i; return *this; }
CONSTEXPR ~B() { finished(); }
CONSTEXPR A finished() { return m_a; }
};

CONSTEXPR B A::operator<<(int i) {
m_val = i;
return B(*this);
}

CONSTEVAL int f()
{
A a = (A() << 1, 2, 3, 4).finished();
return a.val();
}

int g()
{
return f();
}

[Bug c++/104295] ICE: tree check: expected template_decl, have error_mark in build_deduction_guide, at cp/pt.cc:29079

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104295

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||11.2.0, 7.1.0
   Keywords||error-recovery
   Severity|normal  |trivial
 Ever confirmed|0   |1
   Last reconfirmed||2022-01-31
 Status|UNCONFIRMED |NEW

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

[Bug c++/104295] New: ICE: tree check: expected template_decl, have error_mark in build_deduction_guide, at cp/pt.cc:29079

2022-01-30 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104295

Bug ID: 104295
   Summary: ICE: tree check: expected template_decl, have
error_mark in build_deduction_guide, at cp/pt.cc:29079
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

template
struct B;

template 
struct B {
  template
  struct C { C(T); };
};

int main() {
  B::C{0};
}

https://godbolt.org/z/5rxvbd3oe

Maybe dup of Bug 104294, but since their error message is different I opened
this one.

[Bug c++/104294] New: ICE: tree check: accessed elt 2 of 'tree_vec' with 1 elts in tsubst_pack_expansion, at cp/pt.cc:13130

2022-01-30 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104294

Bug ID: 104294
   Summary: ICE: tree check: accessed elt 2 of 'tree_vec' with 1
elts in tsubst_pack_expansion, at cp/pt.cc:13130
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

template
struct B;

template 
struct B {
  template
  struct C { C(T); };
};

int main() {
  B::C{0};
}

https://godbolt.org/z/h1jGhc5b4

[Bug sanitizer/95137] Sanitizers seem to be missing support for coroutines

2022-01-30 Thread pobrn at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95137

Barnabás Pőcze  changed:

   What|Removed |Added

 CC||pobrn at protonmail dot com

--- Comment #46 from Barnabás Pőcze  ---
(In reply to stream009 from comment #42)
> I got strange compile error when I use coroutine with UBSAN.
> 
> The weird thing is error is reported in compile time not runtime.
> The code compile fine without UBSAN.
> [...]
> === begin compile error ===
> : In function 'void _Z5errori.actor(error(int)::_Z5errori.frame*)':
> :21:9: warning: '' may be used uninitialized
> [-Wmaybe-uninitialized]
>21 | co_return;
>   | ^
> :21:9: note: '' was declared here
>21 | co_return;
>   | ^
> === end compile error ===

I am not familiar with the internals of gcc at all, but it appears that this is
due to incorrect code generation. When ubsan is not used, the generated gimple
looks like this:

if (_13 == 0) goto ; else goto ;
:
_14 = &frame_ptr->__p;
result::promise_type::return_void (_14);
goto final.suspend;
:
_15 = &frame_ptr->__p;
result::promise_type::return_void (_15);

when ubsan is used, however:

if (_8 == 0) goto ; else goto ;
:
D.9938 = &frame_ptr->__p;
.UBSAN_NULL (D.9938, 4B, 0);
result::promise_type::return_void (D.9938);
goto final.suspend;
:
.UBSAN_NULL (D.9938, 4B, 0);
result::promise_type::return_void (D.9938);

`D.9938` is not initialized, and I guess hence the warning.

---

I have noticed that this does not happen on
f6f2d6cfec1c2fe9570b98211be58329d8d7749b, so out of curiosity I tried to bisect
gcc:

> git bisect start
> # new: [f6f2d6cfec1c2fe9570b98211be58329d8d7749b] Daily bump.
> git bisect new f6f2d6cfec1c2fe9570b98211be58329d8d7749b
> # old: [7ca388565af176bd4efd4f8db1e5e9e11e98ef45] Update ChangeLog and 
> version files for release
> git bisect old 7ca388565af176bd4efd4f8db1e5e9e11e98ef45
> # old: [250f234988b6231669a720c52101d3686d645072] testsuite: Fix up 
> gcc.target/s390/zero-scratch-regs-1.c
> git bisect old 250f234988b6231669a720c52101d3686d645072
> # old: [79513dc0b2d980bfd1b109d0d502de487c02b894] compiler: don't pad 
> zero-sized trailing field in results struct
> git bisect old 79513dc0b2d980bfd1b109d0d502de487c02b894
> # new: [1b62cddcf091fb8cadf575246a7d3ff778650a6b] Fix ipa-modref pure/const 
> discovery
> git bisect new 1b62cddcf091fb8cadf575246a7d3ff778650a6b
> # new: [247bac507e63b32d4dc23ef1c55f300aafea24c6] libstdc++: Simplify 
> std::basic_regex::assign
> git bisect new 247bac507e63b32d4dc23ef1c55f300aafea24c6
> # new: [d5f8abe1d3f718a75cbff0a453c1d961be5939b7] Use on-demand ranges in 
> ssa_name_has_boolean_range before querying nonzero bits.
> git bisect new d5f8abe1d3f718a75cbff0a453c1d961be5939b7
> # new: [7d79c3ebc3f3f6f8aecf83726c97474ae5cfe957] Don't record string 
> concatenation data for 'RESERVED_LOCATION_P'
> git bisect new 7d79c3ebc3f3f6f8aecf83726c97474ae5cfe957
> # new: [8137be3958be4e5421c283cce3e5b50dbb80b84e] mips: Fix macro typo
> git bisect new 8137be3958be4e5421c283cce3e5b50dbb80b84e
> # old: [caef5203d64e61da506909d58890035af32a6239] Fix internal error on 
> pointer-to-pointer binding in LTO mode
> git bisect old caef5203d64e61da506909d58890035af32a6239
> # new: [cc1e28878a228b6c4a0872e56d97ac88971b7725] libstdc++: Check for TLS 
> support on mingw cross-compilers
> git bisect new cc1e28878a228b6c4a0872e56d97ac88971b7725
> # new: [70ee703c479081ac2ea67eb67041551216e66783] coroutines: Make proxy vars 
> for the function arg copies.
> git bisect new 70ee703c479081ac2ea67eb67041551216e66783
> # old: [bd55fa102715c7442c050b193dadfdb5337e2377] Fix PR ada/101970
> git bisect old bd55fa102715c7442c050b193dadfdb5337e2377
> # old: [f008fd3a480e3718436156697ebe7eeb47841457] c++: Fix 
> __is_*constructible/assignable for templates [PR102305]
> git bisect old f008fd3a480e3718436156697ebe7eeb47841457
> # old: [de07cff96abd43f6f65dcf333958899c2ec42598] c++: empty union member 
> activation during constexpr [PR102163]
> git bisect old de07cff96abd43f6f65dcf333958899c2ec42598
> # skip: [c5a735fa9df7eca4666c8da5e51ed9c5ab7cc81a] coroutines: Expose 
> implementation state to the debugger.
> git bisect skip c5a735fa9df7eca4666c8da5e51ed9c5ab7cc81a
> # only skipped commits left to test
> # possible first new commit: [70ee703c479081ac2ea67eb67041551216e66783] 
> coroutines: Make proxy vars for the function arg copies.
> # possible first new commit: [c5a735fa9df7eca4666c8da5e51ed9c5ab7cc81a] 
> coroutines: Expose implementation state to the debugger.

Unfortunately, when I got to c5a735fa9df7eca4666c8da5e51ed9c5ab7cc81a, it did
not build; I am not sure where I had gone wrong:

> g++ -std=c+

[Bug jit/104293] New: Add support for setting the alignment of variables

2022-01-30 Thread bouanto at zoho dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104293

Bug ID: 104293
   Summary: Add support for setting the alignment of variables
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: jit
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: bouanto at zoho dot com
  Target Milestone: ---

Hi.
I'm opening this issue to track my upcoming patch adding support for setting
the alignment of variables in libgccjit.

[Bug middle-end/78947] sub-optimal code for (bool)(int ? int : int)

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78947

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
Mine for GCC 13.

[Bug tree-optimization/104292] [missed optimization] boolean addition generates suboptimal code

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104292

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
Found it, PR 101703.

[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9

2022-01-30 Thread glaubitz at physik dot fu-berlin.de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189

--- Comment #8 from John Paul Adrian Glaubitz  ---
Any updates on this?

[Bug c++/104291] [12 Regression] gcc accepts template argument involves template parameter(s)

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104291

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Keywords||needs-bisection
   Target Milestone|--- |12.0
Summary|gcc accepts template|[12 Regression] gcc accepts
   |argument involves template  |template argument involves
   |parameter(s)|template parameter(s)
   Last reconfirmed||2022-01-30
 Status|UNCONFIRMED |NEW

--- Comment #1 from Andrew Pinski  ---
Confirmed, this was rejected in GCC 11.1.0 and 11.2.0.

[Bug rtl-optimization/102446] [9/10/11/12 Regression] wrong code at -O3 on x86_64-linux-gnu

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102446

Andrew Pinski  changed:

   What|Removed |Added

   Keywords|needs-bisection |

--- Comment #12 from Andrew Pinski  ---
(In reply to Jakub Jelinek from comment #11)
> It still fails for me.  As I corrected in #c7, I didn't mean ICE but
> miscompilation (at -O3).

Yes it does still fail for me too, I don't know what I was doing wrong last
night.

[Bug c/104289] -fdiagnostics-parseable-fixits doesn't always generate fixit notes

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104289

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug tree-optimization/104292] [missed optimization] boolean addition generates suboptimal code

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104292

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2022-01-30
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #2 from Andrew Pinski  ---
Confirmed, I thought I saw one which was asking about bool + bool == 2 also ...

[Bug tree-optimization/104292] [missed optimization] boolean addition generates suboptimal code

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104292

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Keywords||missed-optimization

[Bug tree-optimization/104292] [missed optimization] boolean addition generates suboptimal code

2022-01-30 Thread avi at scylladb dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104292

--- Comment #1 from Avi Kivity  ---
btw, I see that the equivalent bool_and generates optimal code.

bool_and(bool, bool):
movl%esi, %eax
andl%edi, %eax
ret

Perhaps bool is written with the expectation that any non-zero value is true?
But aren't non-zero values other than 1 undefined behavior?

[Bug tree-optimization/104292] New: [missed optimization] boolean addition generates suboptimal code

2022-01-30 Thread avi at scylladb dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104292

Bug ID: 104292
   Summary: [missed optimization] boolean addition generates
suboptimal code
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: avi at scylladb dot com
  Target Milestone: ---

bool bool_or(bool b1, bool b2) {
return b1 + b2;
}

generates

bool_or(bool, bool):
movzbl  %dil, %edi
movzbl  %sil, %esi
addl%esi, %edi
setne   %al
ret

Whereas it could generate

bool_or(bool, bool):
or   %edi, %esi
mov  %esi, %eax
ret

For a net gain of two instructions (and the final mov can often be elided, so
up to three).

I encountered this while using std::plus<> with boolean types. It could be
optimized as a specialization of std::plus, but I think a magic transformation
in the optimizer would make it apply in more places.

[Bug c++/104291] New: gcc accepts template argument involves template parameter(s)

2022-01-30 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104291

Bug ID: 104291
   Summary: gcc accepts template argument involves template
parameter(s)
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

This should be rejected.

#include

template
struct S { };

template
struct S { };

S x;

https://godbolt.org/z/ecoGPWq3q

[Bug middle-end/95115] RISC-V 64: inf/inf division optimized out, invalid operation not raised

2022-01-30 Thread xry111 at mengyan1223 dot wang via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95115

--- Comment #8 from Xi Ruoyao  ---
This is causing Glibc test failure on every port without hardware acos/asin
instruction.

[Bug libstdc++/92770] std::unordered_map requires both T and U to be fully declared

2022-01-30 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92770

--- Comment #4 from Jonathan Wakely  ---
The relevant changes were r12-4258-g64acc43de1e336 and r12-4259-gd87105d697ced1

[Bug fortran/80524] [F03] Problematic behaviour with a finalization subroutine in gfortran

2022-01-30 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80524

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org

--- Comment #8 from Paul Thomas  ---
(In reply to Jürgen Reuter from comment #7)
> This is still present in the actual trunk.

I can confirm that Intel's interpretation is completely correct. I have a patch
in progress that issues the correct number of final calls but which is ordering
the evaluation of the function result and the finalization of the lhs in the
wrong order.

Paul

[Bug go/104290] New: [12 Regression] trunk 20220126 fails to build libgo on i686-gnu

2022-01-30 Thread doko at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104290

Bug ID: 104290
   Summary: [12 Regression] trunk 20220126 fails to build libgo on
i686-gnu
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: go
  Assignee: ian at airs dot com
  Reporter: doko at debian dot org
CC: cmang at google dot com
  Target Milestone: ---

trunk 20220126 fails to build libgo on i686-gnu:

../../../src/libgo/go/net/unixsock_posix.go:116:56: error: reference to
undefined name 'readMsgFlags'
  116 | n, oobn, flags, sa, err = c.fd.readMsg(b, oob, readMsgFlags)
  |^
../../../src/libgo/go/net/unixsock_posix.go:117:12: error: reference to
undefined name 'readMsgFlags'
  117 | if readMsgFlags == 0 && err == nil && oobn > 0 {
  |^
../../../src/libgo/go/net/unixsock_posix.go:118:17: error: reference to
undefined name 'setReadMsgCloseOnExec'
  118 | setReadMsgCloseOnExec(oob[:oobn])
  | ^
Makefile:3026: recipe for target 'net.lo' failed
make[6]: *** [net.lo] Error 1

[Bug c/104289] New: -fdiagnostics-parseable-fixits doesn't always generate fixit notes

2022-01-30 Thread eric.pouech at orange dot fr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104289

Bug ID: 104289
   Summary: -fdiagnostics-parseable-fixits doesn't always generate
fixit notes
   Product: gcc
   Version: 11.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: eric.pouech at orange dot fr
  Target Milestone: ---

[eric]$ cat b2.c
#include 

#define foo(x...) printf(x);

int main(void)
{
long l = 0;
foo("this is a"
"long line: %d\n", l);  
return 0;
}
[eric]$ LC_ALL=C gcc -Wall -fdiagnostics-parseable-fixits -c b2.c
b2.c: In function 'main':
b2.c:8:9: warning: format '%d' expects argument of type 'int', but argument 2
has type 'long int' [-Wformat=]
8 | foo("this is a"
  | ^~~
9 | "long line: %d\n", l);
  |~
  ||
  |long int
b2.c:3:26: note: in definition of macro 'foo'
3 | #define foo(x...) printf(x);
  |  ^

I'm expecting a fixit note to be present.
Note: the same snipnet without the multi line string, or the macro work as
expected.

[Bug libstdc++/92770] std::unordered_map requires both T and U to be fully declared

2022-01-30 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92770

--- Comment #3 from Jonathan Wakely  ---
Intentionally, but it's not guaranteed to keeps working in future. The standard
still says it's undefined.

[Bug rtl-optimization/102446] [9/10/11/12 Regression] wrong code at -O3 on x86_64-linux-gnu

2022-01-30 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102446

--- Comment #11 from Jakub Jelinek  ---
It still fails for me.  As I corrected in #c7, I didn't mean ICE but
miscompilation (at -O3).

[Bug ipa/103083] [10/11/12 Regression] Wrong code due to ipa-cp's bits value propagation since r10-5538-gc7ac9a0c7e3916f1

2022-01-30 Thread jamborm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103083

Martin Jambor  changed:

   What|Removed |Added

Summary|[10/11/12 Regression] Wrong |[10/11/12 Regression] Wrong
   |code due to ipa-cp's value  |code due to ipa-cp's bits
   |range propagation since |value propagation since
   |r10-5538-gc7ac9a0c7e3916f1  |r10-5538-gc7ac9a0c7e3916f1

--- Comment #4 from Martin Jambor  ---
The last proposal to fix this is in
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585668.html

I will have another look, re-test and ping it soon.

[Bug tree-optimization/104288] [11/12 Regression] EVRP null pointer check removal for strcmp (and maybe others) is not flow senative

2022-01-30 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104288

Jakub Jelinek  changed:

   What|Removed |Added

 CC||aldyh at gcc dot gnu.org,
   ||amacleod at redhat dot com,
   ||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
Started with r11-3685-gfcae5121154d1c3382b056bcc2c563cedac28e74

[Bug tree-optimization/104288] [11/12 Regression] EVRP null pointer check removal for strcmp (and maybe others) is not flow senative

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104288

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||needs-bisection
  Component|middle-end  |tree-optimization

--- Comment #2 from Andrew Pinski  ---
EVRP is removing the null pointer check. I suspect the ranger code is not
taking into account where we are in the IR and it thinks the arguments to
strcmp will be null pointers but before we have other function calls which
might not return.

[Bug middle-end/104288] [11/12 Regression] Null pointer check invalidly deleted

2022-01-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104288

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2022-01-30
Summary|Null pointer check  |[11/12 Regression] Null
   |invalidly deleted   |pointer check invalidly
   ||deleted
   Keywords||wrong-code
   Target Milestone|--- |11.3
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

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

Reduced/more self-contained testcase:
void h(int result) __attribute__((noipa));
void h(int result)
{
if (result)
__builtin_exit(0);
}
void n(const char *value_1) __attribute__((noipa));
void n(const char *value_1)
{
h(value_1 == 0);

int result = !__builtin_strcmp(value_1, "value 1");
__builtin_exit (!result);
}
int main()
{
n(0);
}

[Bug c/104288] New: Null pointer check invalidly deleted

2022-01-30 Thread nrk at disroot dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104288

Bug ID: 104288
   Summary: Null pointer check invalidly deleted
   Product: gcc
   Version: 11.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: nrk at disroot dot org
  Target Milestone: ---

Hi,

In the following code, the null checks are removed when compiled with `-O2` on
gcc v11.2.1. Compiling with `-O2 -fno-delete-null-pointer-checks` produces
proper result.

#include 
#include 
#include 
#include 


#define RESULT_PASS "PASS"
#define RESULT_FAIL "FAIL"


void test_assert(bool result)
{
printf("Assert: %s\n", result ? RESULT_PASS : RESULT_FAIL);

if (!result)
exit(EXIT_FAILURE);
}


void test_strcmp(const char *value_1, const char *value_2)
{
test_assert(value_1 != NULL);
test_assert(value_2 != NULL);

bool result = !strcmp(value_1, value_2);

printf("Test equal: %s\n", result ? RESULT_PASS : RESULT_FAIL);
}


int main()
{
test_strcmp(NULL, "value 1");
}

(code snippet taken from:
https://gist.github.com/novns/c84d6e1efd6304b3076811fef34096fd )

[Bug libstdc++/92770] std::unordered_map requires both T and U to be fully declared

2022-01-30 Thread fchelnokov at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92770

Fedor Chelnokov  changed:

   What|Removed |Added

 CC||fchelnokov at gmail dot com

--- Comment #2 from Fedor Chelnokov  ---
I see that this issue is fixed in GCC trunk. Demo:
https://gcc.godbolt.org/z/Gz5WY495Y

Was it intentionally or by accident?

[Bug c++/58855] Attributes ignored on type alias in template

2022-01-30 Thread gcc at ebasoft dot com.pl via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58855

gcc at ebasoft dot com.pl changed:

   What|Removed |Added

 CC||gcc at ebasoft dot com.pl

--- Comment #3 from gcc at ebasoft dot com.pl ---
This bug is still present in gcc version 11.2.1 20220115

namespace concepts
{
 template
 concept arithmetic = std::integral || std::floating_point;
}
template
using point_vector = T __attribute__((__vector_size__(sizeof(T)*2)));

warning: ignoring attributes applied to dependent type ‘T’ without an
associated declaration [-Wattributes]
   70 | using point_vector = T
__attribute__((__vector_size__(sizeof(T)*2)));
  |   
^

[Bug d/104287] [12 regression] error: spurious trailing punctuation sequence ').' in format [-Werror=format-diag]

2022-01-30 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104287

Andreas Schwab  changed:

   What|Removed |Added

   Target Milestone|--- |12.0

[Bug d/104287] New: [12 regression] error: spurious trailing punctuation sequence ').' in format [-Werror=format-diag]

2022-01-30 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104287

Bug ID: 104287
   Summary: [12 regression] error: spurious trailing punctuation
sequence ').'  in format [-Werror=format-diag]
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: build
  Severity: normal
  Priority: P3
 Component: d
  Assignee: ibuclaw at gdcproject dot org
  Reporter: sch...@linux-m68k.org
  Target Milestone: ---

../../gcc/d/decl.cc: In function 'void d_finish_decl(tree)':
../../gcc/d/decl.cc:1601:53: error: spurious trailing punctuation sequence ').'
in format [-Werror=format-diag]
 1601 |   "its initializer size (%wd).",
  | ^~