* [Bug lto/61123] With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking.
2014-05-09 6:10 [Bug c/61123] New: With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking Hale.Wang at arm dot com
@ 2014-05-09 11:04 ` rguenth at gcc dot gnu.org
2014-05-28 2:42 ` Hale.Wang at arm dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-09 11:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61123
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |lto
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
All ABI changing options should be also enabled for LTO and they also deserve
handling in lto-opts.c (always stream, not only if explicitely set) and
lto-wrapper.c (diagnose mismatches and force a setting for the link stage).
At least enabling them for LTO is minimally required, like you suggest.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/61123] With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking.
2014-05-09 6:10 [Bug c/61123] New: With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking Hale.Wang at arm dot com
2014-05-09 11:04 ` [Bug lto/61123] " rguenth at gcc dot gnu.org
@ 2014-05-28 2:42 ` Hale.Wang at arm dot com
2014-05-30 4:45 ` Hale.Wang at arm dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Hale.Wang at arm dot com @ 2014-05-28 2:42 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5905 bytes --]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61123
--- Comment #2 from Hale Wang <Hale.Wang at arm dot com> ---
(In reply to Richard Biener from comment #1)
> All ABI changing options should be also enabled for LTO and they also deserve
> handling in lto-opts.c (always stream, not only if explicitely set) and
> lto-wrapper.c (diagnose mismatches and force a setting for the link stage).
>
> At least enabling them for LTO is minimally required, like you suggest.
Hi Richard,
I was dealing with the fno-short-enum bug that LTO ignore the options of
fshort-enum and fshort-wchar(fshort-wchar is similar with fshort-enum). I tried
to fix this bug by adding these options to LTO group. And this solution works.
Right now, I am trying to add some test cases to report some error message for
these cases in the previous gcc versions. And these cases will be passed after
I add these options to LTO group.
For the option of fshort-enum, I catch the Tag_ABI_enum_size from the final
executable. And this test case can work very well now.
But for the option of fshort-wchar, if I compile the source files without
"-flto" option, I can catch the Tag_ABI_PCS_wchar_t from the final executable.
If I add the "-flto" option to the compile command, the Tag_ABI_PCS_wchar_t is
totally disappeared in the final executable.
So I think this is another bug which means the final executable file (or the
ABI) is different if we add "-flto" or not.
I generated a minimal example.I have two source files:
wchar_0.c:
#include <stddef.h>
wchar_t wc0[]=Lâabcâ;
const wchar_t wc1[]=Lâabcâ;
wchar_1.c:
#include <stddef.h>
wchar_t b0[]={ Lâabcâ };
const wchar_t b1[]={ Lâabcâ };
Firstly, I compile these files without â-fltoâ:
$ arm-none-eabi-gcc -fshort-wchar wchar_0.c wchar_1.c -Wl,-Ur -o
without_flto.o -nostdlib -Os
$ arm-none-eabi-readelf -A without_flto.o
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "ARM7TDMI"
Tag_CPU_arch: v4T
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_ABI_PCS_wchar_t: 2
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: small
Tag_ABI_optimization_goals: Aggressive Size
Then I compile these files with âflto:
$ arm-none-eabi-gcc -fshort-wchar wchar_0.c wchar_1.c -Wl,-Ur -o
with_flto.o -nostdlib -Os âflto
$ arm-none-eabi-readelf -A with_flto.o
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "ARM7TDMI"
Tag_CPU_arch: v4T
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: small
Tag_ABI_optimization_goals: Aggressive Size
So we can see the Tag_ABI_PCS_wchar_t attribute is totally disappeared.
What do you think about this?
>From gcc-bugs-return-452668-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 28 07:21:56 2014
Return-Path: <gcc-bugs-return-452668-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 20448 invoked by alias); 28 May 2014 07:21:55 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 20418 invoked by uid 48); 28 May 2014 07:21:51 -0000
From: "Joost.VandeVondele at mat dot ethz.ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/61335] New: [4.10 Regression] wrong code with -O2 -fbounds-check
Date: Wed, 28 May 2014 07:21:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: Joost.VandeVondele at mat dot ethz.ch
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-61335-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg02360.txt.bz2
Content-length: 885
https://gcc.gnu.org/bugzilla/show_bug.cgi?ida335
Bug ID: 61335
Summary: [4.10 Regression] wrong code with -O2 -fbounds-check
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: Joost.VandeVondele at mat dot ethz.ch
Created attachment 32868
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id2868&actioníit
reduced testcase
The attached testcase is miscompiled with current trunk. A recent regression
caused in the day between good: r210955 and bad: r210994
To reproduce compile and run the attached testcase as :
> gfortran -O2 -fbounds-check cp_units.f90 ; ./a.out
BUG : XXXfs^-1XXX integer expected
STOP 1
while e.g. '-O2' alone or '-fbound-check -O1' work fine.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/61123] With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking.
2014-05-09 6:10 [Bug c/61123] New: With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking Hale.Wang at arm dot com
2014-05-09 11:04 ` [Bug lto/61123] " rguenth at gcc dot gnu.org
2014-05-28 2:42 ` Hale.Wang at arm dot com
@ 2014-05-30 4:45 ` Hale.Wang at arm dot com
2014-06-20 4:52 ` zqchen at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Hale.Wang at arm dot com @ 2014-05-30 4:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61123
--- Comment #4 from Hale Wang <Hale.Wang at arm dot com> ---
(In reply to Richard Biener from comment #3)
> It seems that Tag_ABI_PCS_wchar_t is emitted from the C-family frontends only
> via config/arm/arm-c.c (as opposed to any other Tags). Probably because
> the option is c-family specific. This code needs to move to generic handling
> (the option enum is shared across all frontends, so that's not a reason to
> keep it in a C specific file).
Thanks very much for your comments. So this seems to be a separate issue that
the Tag_ABI_PCS_wchar_t need to be moved to LTO frontend at least,but not only
the C frontend. May be I need to creat another patch or bug description for
this issue.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/61123] With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking.
2014-05-09 6:10 [Bug c/61123] New: With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking Hale.Wang at arm dot com
` (2 preceding siblings ...)
2014-05-30 4:45 ` Hale.Wang at arm dot com
@ 2014-06-20 4:52 ` zqchen at gcc dot gnu.org
2014-06-20 6:12 ` Hale.Wang at arm dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: zqchen at gcc dot gnu.org @ 2014-06-20 4:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61123
--- Comment #5 from zqchen at gcc dot gnu.org ---
Author: zqchen
Date: Fri Jun 20 04:52:11 2014
New Revision: 211832
URL: https://gcc.gnu.org/viewcvs?rev=211832&root=gcc&view=rev
Log:
c-family/ChangeLog
2014-06-20 Hale Wang <hale.wang@arm.com>
PR lto/61123
* c.opt (fshort-enums): Add to LTO.
* c.opt (fshort-wchar): Likewise.
testsuite/ChangeLog
2014-06-20 Hale Wang <hale.wang@arm.com>
* gcc.target/arm/lto/: New folder to verify the LTO option.
* gcc.target/arm/lto/pr61123-enum-size_0.c: New test case.
* gcc.target/arm/lto/pr61123-enum-size_1.c: Likewise.
* gcc.target/arm/lto/lto.exp: New exp file used to test LTO option.
* lib/lto.exp (object-readelf): New procedure.
Added:
trunk/gcc/testsuite/gcc.target/arm/lto/
trunk/gcc/testsuite/gcc.target/arm/lto/lto.exp
trunk/gcc/testsuite/gcc.target/arm/lto/pr61123-enum-size_0.c
trunk/gcc/testsuite/gcc.target/arm/lto/pr61123-enum-size_1.c
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/lib/lto.exp
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/61123] With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking.
2014-05-09 6:10 [Bug c/61123] New: With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking Hale.Wang at arm dot com
` (3 preceding siblings ...)
2014-06-20 4:52 ` zqchen at gcc dot gnu.org
@ 2014-06-20 6:12 ` Hale.Wang at arm dot com
2014-06-23 10:26 ` rguenth at gcc dot gnu.org
2014-07-29 7:11 ` xguo at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: Hale.Wang at arm dot com @ 2014-06-20 6:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61123
--- Comment #6 from Hale Wang <Hale.Wang at arm dot com> ---
Thanks for Zhenqiang Chen's help. This bug is fixed. Refer to the link
https://gcc.gnu.org/ml/gcc-patches/2014-06/msg01429.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/61123] With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking.
2014-05-09 6:10 [Bug c/61123] New: With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking Hale.Wang at arm dot com
` (4 preceding siblings ...)
2014-06-20 6:12 ` Hale.Wang at arm dot com
@ 2014-06-23 10:26 ` rguenth at gcc dot gnu.org
2014-07-29 7:11 ` xguo at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-23 10:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61123
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/61123] With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking.
2014-05-09 6:10 [Bug c/61123] New: With LTO, -fno-short-enums is ignored, resulting in ABI mis-matching in linking Hale.Wang at arm dot com
` (5 preceding siblings ...)
2014-06-23 10:26 ` rguenth at gcc dot gnu.org
@ 2014-07-29 7:11 ` xguo at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: xguo at gcc dot gnu.org @ 2014-07-29 7:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61123
--- Comment #8 from xuepeng guo <xguo at gcc dot gnu.org> ---
Author: xguo
Date: Tue Jul 29 07:11:02 2014
New Revision: 213147
URL: https://gcc.gnu.org/viewcvs?rev=213147&root=gcc&view=rev
Log:
gcc/c-family/
2014-07-29 Terry Guo <terry.guo@arm.com>
Backport mainline r211832
2014-06-20 Hale Wang <hale.wang@arm.com>
PR lto/61123
* c.opt (fshort-enums): Add to LTO.
* c.opt (fshort-wchar): Likewise.
gcc/testsuite/
2014-07-29 Terry Guo <terry.guo@arm.com>
Backport mainline r211832
2014-06-20 Hale Wang <hale.wang@arm.com>
* gcc.target/arm/lto/: New folder to verify the LTO option.
* gcc.target/arm/lto/pr61123-enum-size_0.c: New test case.
* gcc.target/arm/lto/pr61123-enum-size_1.c: Likewise.
* gcc.target/arm/lto/lto.exp: New exp file used to test LTO option.
* lib/lto.exp (object-readelf): New procedure.
Added:
branches/ARM/embedded-4_8-branch/gcc/c-family/ChangeLog.arm
branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.target/arm/lto/
branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.target/arm/lto/lto.exp
branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.target/arm/lto/pr61123-enum-size_0.c
branches/ARM/embedded-4_8-branch/gcc/testsuite/gcc.target/arm/lto/pr61123-enum-size_1.c
Modified:
branches/ARM/embedded-4_8-branch/gcc/c-family/c.opt
branches/ARM/embedded-4_8-branch/gcc/testsuite/ChangeLog.arm
branches/ARM/embedded-4_8-branch/gcc/testsuite/lib/lto.exp
^ permalink raw reply [flat|nested] 8+ messages in thread