* [Bug c/111734] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre'
2023-10-09 10:02 [Bug c/111734] New: wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' 19373742 at buaa dot edu.cn
@ 2023-10-09 10:03 ` 19373742 at buaa dot edu.cn
2023-10-09 12:42 ` 19373742 at buaa dot edu.cn
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: 19373742 at buaa dot edu.cn @ 2023-10-09 10:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734
--- Comment #1 from CTC <19373742 at buaa dot edu.cn> ---
Created attachment 56078
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56078&action=edit
The compiler output
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/111734] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre'
2023-10-09 10:02 [Bug c/111734] New: wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' 19373742 at buaa dot edu.cn
2023-10-09 10:03 ` [Bug c/111734] " 19373742 at buaa dot edu.cn
@ 2023-10-09 12:42 ` 19373742 at buaa dot edu.cn
2023-10-10 2:38 ` [Bug tree-optimization/111734] [14 Regression] " pinskia at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: 19373742 at buaa dot edu.cn @ 2023-10-09 12:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734
--- Comment #2 from CTC <19373742 at buaa dot edu.cn> ---
A reduced testcase:
#include<stdio.h>
#include<inttypes.h>
struct a {};
struct {
uint32_t b;
int16_t c;
} d, f = {9, 1};
int32_t e;
static int32_t *g();
static uint32_t h() {
int32_t *i = &e;
struct a j;
g(j, i, &i);
if (*i)
f = d;
}
int32_t *g(uint32_t, int32_t, int32_t **m) {
int32_t *k = &e;
*m = k;
}
int main() {
h();
printf("%d\n", f.c);
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre'
2023-10-09 10:02 [Bug c/111734] New: wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' 19373742 at buaa dot edu.cn
2023-10-09 10:03 ` [Bug c/111734] " 19373742 at buaa dot edu.cn
2023-10-09 12:42 ` 19373742 at buaa dot edu.cn
@ 2023-10-10 2:38 ` pinskia at gcc dot gnu.org
2023-10-17 13:11 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-10 2:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Summary|wrong code with '-O3 |[14 Regression] wrong code
|-fno-inline-functions-calle |with '-O3
|d-once |-fno-inline-functions-calle
|-fno-inline-small-functions |d-once
|-fno-omit-frame-pointer |-fno-inline-small-functions
|-fno-toplevel-reorder |-fno-omit-frame-pointer
|-fno-tree-fre' |-fno-toplevel-reorder
| |-fno-tree-fre'
Last reconfirmed| |2023-10-10
Component|c |tree-optimization
Target Milestone|--- |14.0
Status|UNCONFIRMED |NEW
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
PRE does:
Processing block 0: BB2
Value numbering stmt = *m_1(D) = &e;
RHS &e simplified to &e
No store match
Value numbering store *m_1(D) to &e
Setting value number of .MEM_3 to .MEM_
...
Starting insert iteration 1
Deleted redundant store *m_1(D) = &e;
Removing dead stmt *m_1(D) = &e;
Better reduced testcase:
```
struct a {};
struct {
unsigned b;
unsigned short c;
} d, f = {9, 1};
int e;
static void g(unsigned, __SIZE_TYPE__, int **m);
static void h() {
int *i = &e;
g(0, (__SIZE_TYPE__)i, &i);
if (*i)
f = d;
}
void g(unsigned a, __SIZE_TYPE__ b, int **m) {
*m = &e;
}
int main() {
h();
if (f.c != 1)
__builtin_abort();
}
```
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre'
2023-10-09 10:02 [Bug c/111734] New: wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' 19373742 at buaa dot edu.cn
` (2 preceding siblings ...)
2023-10-10 2:38 ` [Bug tree-optimization/111734] [14 Regression] " pinskia at gcc dot gnu.org
@ 2023-10-17 13:11 ` rguenth at gcc dot gnu.org
2023-10-31 3:27 ` sjames at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-17 13:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org,
| |jamborm at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
Priority|P3 |P1
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
-fno-ipa-modref fixes it.
Fails with -O3 -fno-inline -fno-toplevel-reorder -fno-tree-fre
--- a-t.c.146t.pre 2023-10-17 15:07:52.544953598 +0200
+++ a-t.c.146t.pre.bad 2023-10-17 15:07:45.788953643 +0200
@@ -25,7 +25,6 @@
int _4;
<bb 2> [local count: 1073741824]:
- i = &e;
g.constprop (&i);
i.2_3 = i;
_4 = *i.2_3;
I think this is a duplicate of the modref / IPA-CP issue (failing to remember
the PR number) which IIRC has a patch under review.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre'
2023-10-09 10:02 [Bug c/111734] New: wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' 19373742 at buaa dot edu.cn
` (3 preceding siblings ...)
2023-10-17 13:11 ` rguenth at gcc dot gnu.org
@ 2023-10-31 3:27 ` sjames at gcc dot gnu.org
2023-10-31 5:19 ` sjames at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-10-31 3:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734
--- Comment #5 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #4)
> [...]
> I think this is a duplicate of the modref / IPA-CP issue (failing to remember
> the PR number) which IIRC has a patch under review.
PR111157 or maybe PR108007?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre'
2023-10-09 10:02 [Bug c/111734] New: wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' 19373742 at buaa dot edu.cn
` (4 preceding siblings ...)
2023-10-31 3:27 ` sjames at gcc dot gnu.org
@ 2023-10-31 5:19 ` sjames at gcc dot gnu.org
2023-10-31 6:27 ` [Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' since r14-3226-gd073e2d75d9ed4 sjames at gcc dot gnu.org
2023-10-31 7:43 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-10-31 5:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734
--- Comment #6 from Sam James <sjames at gcc dot gnu.org> ---
-fharden-control-flow-redundancy suppresses it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' since r14-3226-gd073e2d75d9ed4
2023-10-09 10:02 [Bug c/111734] New: wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' 19373742 at buaa dot edu.cn
` (5 preceding siblings ...)
2023-10-31 5:19 ` sjames at gcc dot gnu.org
@ 2023-10-31 6:27 ` sjames at gcc dot gnu.org
2023-10-31 7:43 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-10-31 6:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734
Sam James <sjames at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[14 Regression] wrong code |[14 Regression] wrong code
|with '-O3 |with '-O3
|-fno-inline-functions-calle |-fno-inline-functions-calle
|d-once |d-once
|-fno-inline-small-functions |-fno-inline-small-functions
|-fno-omit-frame-pointer |-fno-omit-frame-pointer
|-fno-toplevel-reorder |-fno-toplevel-reorder
|-fno-tree-fre' |-fno-tree-fre' since
| |r14-3226-gd073e2d75d9ed4
--- Comment #7 from Sam James <sjames at gcc dot gnu.org> ---
d073e2d75d9ed492de9a8dc6970e5b69fae20e5a is the first bad commit
commit d073e2d75d9ed492de9a8dc6970e5b69fae20e5a
Author: Martin Jambor <mjambor@suse.cz>
Date: Tue Aug 15 17:26:13 2023 +0200
Feed results of IPA-CP into tree value numbering
i.e. r14-3226-gd073e2d75d9ed4.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' since r14-3226-gd073e2d75d9ed4
2023-10-09 10:02 [Bug c/111734] New: wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' 19373742 at buaa dot edu.cn
` (6 preceding siblings ...)
2023-10-31 6:27 ` [Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' since r14-3226-gd073e2d75d9ed4 sjames at gcc dot gnu.org
@ 2023-10-31 7:43 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-31 7:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
PR111157, and indeed, confirmed fixed now.
*** This bug has been marked as a duplicate of bug 111157 ***
^ permalink raw reply [flat|nested] 9+ messages in thread