public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/59649] New: [4.9 regression] conftest.c miscompiled
@ 2013-12-31 11:27 schwab@linux-m68k.org
2013-12-31 13:24 ` [Bug rtl-optimization/59649] " schwab@linux-m68k.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2013-12-31 11:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59649
Bug ID: 59649
Summary: [4.9 regression] conftest.c miscompiled
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: build, wrong-code
Severity: critical
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: schwab@linux-m68k.org
CC: nickc at gcc dot gnu.org
Blocks: 59613
Target: ia64-*-*
>From ia64-suse-linux/libgomp/config.log:
configure:16188: /usr/local/gcc/test/Build/./gcc/xgcc
-B/usr/local/gcc/test/Build/./gcc/ -B/usr/ia64-suse-linux/bin/
-B/usr/ia64-suse-linux/lib/ -isystem /usr/ia64-suse-linux/include -isystem
/usr/ia64-suse-linux/sys-include -o conftest -g -O2 -include confdefs.h
-include ../../../libgomp/config/linux/omp-lock.h conftest.c -lrt >&5
configure:16188: $? = 0
configure:16188: ./conftest
configure:16188: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU OpenMP Runtime Library"
| #define PACKAGE_TARNAME "libgomp"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU OpenMP Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgomp/"
| #define PACKAGE "libgomp"
| #define VERSION "1.0"
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define TIME_WITH_SYS_TIME 1
| #define STRING_WITH_STRINGS 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SEMAPHORE_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_GETLOADAVG 1
| #define HAVE_STRTOULL 1
| #define HAVE_PTHREAD_AFFINITY_NP 1
| #define HAVE_CLOCK_GETTIME 1
| #define HAVE_TLS 1
| #define HAVE_ATTRIBUTE_VISIBILITY 1
| #define HAVE_ATTRIBUTE_ALIAS 1
| #define HAVE_AS_SYMVER_DIRECTIVE 1
| #define HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT 1
| #define LIBGOMP_GNU_SYMBOL_VERSIONING 1
| #define HAVE_SYNC_BUILTINS 1
| /* end confdefs.h. */
|
| static long int longval () { return sizeof (omp_lock_t); }
| static unsigned long int ulongval () { return sizeof (omp_lock_t); }
| #include <stdio.h>
| #include <stdlib.h>
| int
| main ()
| {
|
| FILE *f = fopen ("conftest.val", "w");
| if (! f)
| return 1;
| if ((sizeof (omp_lock_t)) < 0)
| {
| long int i = longval ();
| if (i != (sizeof (omp_lock_t)))
| return 1;
| fprintf (f, "%ld", i);
| }
| else
| {
| unsigned long int i = ulongval ();
| if (i != (sizeof (omp_lock_t)))
| return 1;
| fprintf (f, "%lu", i);
| }
| /* Do not output a trailing newline, as this causes \r\n confusion
| on some platforms. */
| return ferror (f) || fclose (f) != 0;
|
| ;
| return 0;
| }
configure:16191: error: unsupported system, cannot find sizeof (omp_lock_t)
The test program is miscompiled to always return 1.
(gdb) disass main
Dump of assembler code for function main:
0x4000000000000600 <+0>: [MMB] alloc r34=ar.pfs,7,4,0
0x4000000000000601 <+1>: addl r37=288,r1
0x4000000000000602 <+2>: nop.b 0x0
0x4000000000000610 <+16>: [MII] addl r36=280,r1
0x4000000000000611 <+17>: mov r33=b0
0x4000000000000612 <+18>: mov r35=r1;;
0x4000000000000620 <+32>: [MMI] nop.m 0x0
0x4000000000000621 <+33>: ld8 r37=[r37]
0x4000000000000622 <+34>: nop.i 0x0
0x4000000000000630 <+48>: [MMB] ld8 r36=[r36]
0x4000000000000631 <+49>: nop.m 0x0
0x4000000000000632 <+50>: br.call.sptk.many
b0=0x4000000000000540;;
0x4000000000000640 <+64>: [MMI] mov r1=r35
0x4000000000000641 <+65>: nop.m 0x0
0x4000000000000642 <+66>: mov r32=r8
0x4000000000000650 <+80>: [MII] mov r38=4
0x4000000000000651 <+81>: mov r36=r8;;
0x4000000000000652 <+82>: addl r37=296,r1;;
0x4000000000000660 <+96>: [MIB] ld8 r37=[r37]
0x4000000000000661 <+97>: nop.i 0x0
0x4000000000000662 <+98>: br.call.sptk.many
b0=0x40000000000005c0;;
0x4000000000000670 <+112>: [MIB] mov r1=r35
0x4000000000000671 <+113>: mov r36=r32
0x4000000000000672 <+114>: br.call.sptk.many
b0=0x4000000000000560;;
0x4000000000000680 <+128>: [MMI] mov r8=1
0x4000000000000681 <+129>: mov r1=r35
0x4000000000000682 <+130>: mov.i ar.pfs=r34;;
0x4000000000000690 <+144>: [MIB] nop.m 0x0
0x4000000000000691 <+145>: mov b0=r33
0x4000000000000692 <+146>: br.ret.sptk.many b0;;
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/59649] [4.9 regression] conftest.c miscompiled
2013-12-31 11:27 [Bug rtl-optimization/59649] New: [4.9 regression] conftest.c miscompiled schwab@linux-m68k.org
@ 2013-12-31 13:24 ` schwab@linux-m68k.org
2014-01-02 14:52 ` ebotcazou at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2013-12-31 13:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59649
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
gen_int_mode(-1, BImode) returning (const_int 1) looks wrong.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/59649] [4.9 regression] conftest.c miscompiled
2013-12-31 11:27 [Bug rtl-optimization/59649] New: [4.9 regression] conftest.c miscompiled schwab@linux-m68k.org
2013-12-31 13:24 ` [Bug rtl-optimization/59649] " schwab@linux-m68k.org
@ 2014-01-02 14:52 ` ebotcazou at gcc dot gnu.org
2014-01-06 9:39 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2014-01-02 14:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59649
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-01-02
CC| |ebotcazou at gcc dot gnu.org
Target Milestone|--- |4.9.0
Ever confirmed|0 |1
--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
I have it too.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/59649] [4.9 regression] conftest.c miscompiled
2013-12-31 11:27 [Bug rtl-optimization/59649] New: [4.9 regression] conftest.c miscompiled schwab@linux-m68k.org
2013-12-31 13:24 ` [Bug rtl-optimization/59649] " schwab@linux-m68k.org
2014-01-02 14:52 ` ebotcazou at gcc dot gnu.org
@ 2014-01-06 9:39 ` jakub at gcc dot gnu.org
2014-01-06 9:59 ` ebotcazou at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-06 9:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59649
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, IMHO either get_mode_bounds needs to special case BImode like
trunc_int_for_mode does and make the bounds of BImode include values of 0 and
STORE_FLAG_VALUE, or the BImode hunk in trunc_int_for_mode needs to be dropped
and everything analyzed for assumption that BImode true is CONST_INT equal to
STORE_FLAG_VALUE, or ia64 needs to use STORE_FLAG_VALUE -1 (there is a comment
about it in ia64.h that it should be investigated).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/59649] [4.9 regression] conftest.c miscompiled
2013-12-31 11:27 [Bug rtl-optimization/59649] New: [4.9 regression] conftest.c miscompiled schwab@linux-m68k.org
` (2 preceding siblings ...)
2014-01-06 9:39 ` jakub at gcc dot gnu.org
@ 2014-01-06 9:59 ` ebotcazou at gcc dot gnu.org
2014-01-07 18:05 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2014-01-06 9:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59649
--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> So, IMHO either get_mode_bounds needs to special case BImode like
> trunc_int_for_mode does and make the bounds of BImode include values of 0
> and STORE_FLAG_VALUE, or the BImode hunk in trunc_int_for_mode needs to be
> dropped and everything analyzed for assumption that BImode true is CONST_INT
> equal to STORE_FLAG_VALUE, or ia64 needs to use STORE_FLAG_VALUE -1 (there
> is a comment about it in ia64.h that it should be investigated).
Given that ia64 is barely maintained these days, the 3rd approach doesn't look
very realistic and the 2nd one a little risky, so the 1st approach is very
likely the way to go I'd think (e.g. if_then_else_cond also special-cases
BImode).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/59649] [4.9 regression] conftest.c miscompiled
2013-12-31 11:27 [Bug rtl-optimization/59649] New: [4.9 regression] conftest.c miscompiled schwab@linux-m68k.org
` (3 preceding siblings ...)
2014-01-06 9:59 ` ebotcazou at gcc dot gnu.org
@ 2014-01-07 18:05 ` jakub at gcc dot gnu.org
2014-01-07 19:17 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-07 18:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59649
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 31767
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31767&action=edit
gcc49-pr59649.patch
Untested fix (well, tested on the conftest.c and eyeballing it using cross).
Don't have spare cycles to waste on a ia64 though, so if somebody is willing to
bootstrap/regtest it, I'd appreciate it.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/59649] [4.9 regression] conftest.c miscompiled
2013-12-31 11:27 [Bug rtl-optimization/59649] New: [4.9 regression] conftest.c miscompiled schwab@linux-m68k.org
` (4 preceding siblings ...)
2014-01-07 18:05 ` jakub at gcc dot gnu.org
@ 2014-01-07 19:17 ` jakub at gcc dot gnu.org
2014-01-07 23:05 ` ebotcazou at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-07 19:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59649
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Two out of the 3 get_mode_bounds calls pass the same mode as the first and
third argument, so in that case it would be BImode in both cases and even
before Nick's change while min_val/max_val would be -128/127 for signed and
0/255 otherwise,
as the value is then trunc_int_for_mode (into BImode again), which will return
STORE_FLAG_VALUE for & 1 and 0 otherwise, the function returned 0 and
STORE_FLAG_VALUE (for STORE_FLAG_VALUE == -1 a wrong thing to do supposedly,
but that is not the case of ia64).
I wonder if get_mode_bounds is ever called with BImode and some wider mode,
that would mean there would need to be a conversion of some wider mode to
BImode in the IL I think, which is quite unlikely. Normally BImode is the
result of some comparison instead.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/59649] [4.9 regression] conftest.c miscompiled
2013-12-31 11:27 [Bug rtl-optimization/59649] New: [4.9 regression] conftest.c miscompiled schwab@linux-m68k.org
` (5 preceding siblings ...)
2014-01-07 19:17 ` jakub at gcc dot gnu.org
@ 2014-01-07 23:05 ` ebotcazou at gcc dot gnu.org
2014-01-08 10:01 ` [Bug rtl-optimization/59649] [4.9 regression] BImode miscompiled jakub at gcc dot gnu.org
2014-01-08 10:02 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2014-01-07 23:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59649
--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Everything seems to be OK with the patch.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/59649] [4.9 regression] BImode miscompiled
2013-12-31 11:27 [Bug rtl-optimization/59649] New: [4.9 regression] conftest.c miscompiled schwab@linux-m68k.org
` (6 preceding siblings ...)
2014-01-07 23:05 ` ebotcazou at gcc dot gnu.org
@ 2014-01-08 10:01 ` jakub at gcc dot gnu.org
2014-01-08 10:02 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-08 10:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59649
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Wed Jan 8 10:01:29 2014
New Revision: 206422
URL: http://gcc.gnu.org/viewcvs?rev=206422&root=gcc&view=rev
Log:
PR rtl-optimization/59649
* stor-layout.c (get_mode_bounds): For BImode return
0 and STORE_FLAG_VALUE.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/stor-layout.c
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/59649] [4.9 regression] BImode miscompiled
2013-12-31 11:27 [Bug rtl-optimization/59649] New: [4.9 regression] conftest.c miscompiled schwab@linux-m68k.org
` (7 preceding siblings ...)
2014-01-08 10:01 ` [Bug rtl-optimization/59649] [4.9 regression] BImode miscompiled jakub at gcc dot gnu.org
@ 2014-01-08 10:02 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-08 10:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59649
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Thanks to you both.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-01-08 10:02 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-31 11:27 [Bug rtl-optimization/59649] New: [4.9 regression] conftest.c miscompiled schwab@linux-m68k.org
2013-12-31 13:24 ` [Bug rtl-optimization/59649] " schwab@linux-m68k.org
2014-01-02 14:52 ` ebotcazou at gcc dot gnu.org
2014-01-06 9:39 ` jakub at gcc dot gnu.org
2014-01-06 9:59 ` ebotcazou at gcc dot gnu.org
2014-01-07 18:05 ` jakub at gcc dot gnu.org
2014-01-07 19:17 ` jakub at gcc dot gnu.org
2014-01-07 23:05 ` ebotcazou at gcc dot gnu.org
2014-01-08 10:01 ` [Bug rtl-optimization/59649] [4.9 regression] BImode miscompiled jakub at gcc dot gnu.org
2014-01-08 10:02 ` jakub at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).