public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/19382] New: ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux
@ 2005-01-11 21:10 laurent at guerby dot net
2005-01-15 0:46 ` [Bug ada/19382] " uweigand at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: laurent at guerby dot net @ 2005-01-11 21:10 UTC (permalink / raw)
To: gcc-bugs
,.,. CXB5002 ACATS 2.5 05-01-11 13:45:01
---- CXB5002 Check that functions To_Fortran and To_Ada produce correct
results.
* CXB5002 Incorrect result from procedure To_Fortran - 1.
* CXB5002 Incorrect value returned from function To_Ada - 1.
**** CXB5002 FAILED ****************************.
--
Summary: ACATS cxb5002 simple To_Fortran test fails at runtime on
s390-linux
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: laurent at guerby dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: s390-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19382
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ada/19382] ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux
2005-01-11 21:10 [Bug ada/19382] New: ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux laurent at guerby dot net
@ 2005-01-15 0:46 ` uweigand at gcc dot gnu dot org
2005-03-17 10:49 ` charlet at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: uweigand at gcc dot gnu dot org @ 2005-01-15 0:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uweigand at gcc dot gnu dot org 2005-01-15 00:45 -------
This is caused by instruction scheduling not noticing a dependency,
apparently because alias sets are set up incorrectly.
At the end of the tree optimizer phase we have:
<L29>:;
fortran_character_1[1]{lb: 1 sz: 1} =
VIEW_CONVERT_EXPR<interfaces__fortran__character_set[1:1]>(*SR.237)[1]{lb: 1 sz: 1};
tc_fortran_character_1.26 = (const <unnamed type> *) &tc_fortran_character_1;
D.2019 = *tc_fortran_character_1.26;
<bb 56>:
D.2020 = (integer) D.2019;
fortran_character_1.27 = (interfaces__fortran__character_set[1:1] *)
&fortran_character_1;
D.2023 = *(const <unnamed type> *) fortran_character_1.27;
<bb 57>:
if (D.2020 - (integer) D.2023 != 0) goto <L30>; else goto <L31>;
<L30>:;
D.2026 = C.29;
report__failed (D.2026);
which gets expanded into RTL like so:
(insn 497 496 499 73 (set (mem/s/j:QI (reg/f:SI 39 virtual-stack-vars) [11
fortran_character_1+0 S1 A64])
(mem/s/j:QI (reg/f:SI 123 [ SR.237 ]) [11 S1 A8])) -1 (nil)
(nil))
[snip]
(insn 503 502 504 74 (set (reg:SI 268 [ fortran_character_1.27 ])
(reg/f:SI 39 virtual-stack-vars)) -1 (nil)
(nil))
(insn 504 503 505 74 (set (reg:QI 267 [ D.2023 ])
(mem:QI (reg:SI 268 [ fortran_character_1.27 ]) [28 S1 A8])) -1 (nil)
(expr_list:REG_EH_REGION (const_int 2 [0x2])
(nil)))
Notice how the store to fortran_character uses alias set 11,
while the read (via the fortran_character_1.27 pointer) uses
alias set 28.
The whole section gets further simplified to
(insn 1955 506 1956 56 (parallel [
(set (mem/s/j:BLK (plus:SI (reg/f:SI 15 %r15)
(const_int 96 [0x60])) [11 fortran_character_1+0 S1 A64])
(mem/s/j:BLK (reg/f:SI 4 %r4 [orig:123 SR.237 ] [123]) [11 S1 A8]))
(use (const_int 1 [0x1]))
]) 61 {*mvc} (nil)
(expr_list:REG_DEAD (reg/f:SI 4 %r4 [orig:123 SR.237 ] [123])
(nil)))
(insn 1956 1955 508 56 (parallel [
(set (reg:CCZ 33 %cc)
(compare:CCZ (mem:BLK (plus:SI (reg/f:SI 15 %r15)
(const_int 96 [0x60])) [28 S1 A8])
(mem:BLK (plus:SI (reg/f:SI 15 %r15)
(const_int 97 [0x61])) [28 S1 A8])))
(use (const_int 1 [0x1]))
]) 31 {*clc} (nil)
(nil))
I.e. first the store to fortran_character, the the compare.
The scheduler now swaps the two insns, causing incorrect code
to be generated. It hasn't recognized the dependency, presumably
because the alias sets are incorrect ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19382
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ada/19382] ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux
2005-01-11 21:10 [Bug ada/19382] New: ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux laurent at guerby dot net
2005-01-15 0:46 ` [Bug ada/19382] " uweigand at gcc dot gnu dot org
@ 2005-03-17 10:49 ` charlet at gcc dot gnu dot org
2005-03-18 18:47 ` laurent at guerby dot net
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: charlet at gcc dot gnu dot org @ 2005-03-17 10:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From charlet at gcc dot gnu dot org 2005-03-17 10:47 -------
Is this test still failing ?
Arno
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19382
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ada/19382] ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux
2005-01-11 21:10 [Bug ada/19382] New: ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux laurent at guerby dot net
2005-01-15 0:46 ` [Bug ada/19382] " uweigand at gcc dot gnu dot org
2005-03-17 10:49 ` charlet at gcc dot gnu dot org
@ 2005-03-18 18:47 ` laurent at guerby dot net
2005-06-17 15:10 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: laurent at guerby dot net @ 2005-03-18 18:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From laurent at guerby dot net 2005-03-18 18:46 -------
Still fails on 4.0.0 20050317 (prerelease) testsuite on s390-ibm-linux-gnu
according to:
http://gcc.gnu.org/ml/gcc-testresults/2005-03/msg01185.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19382
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ada/19382] ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux
2005-01-11 21:10 [Bug ada/19382] New: ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux laurent at guerby dot net
` (2 preceding siblings ...)
2005-03-18 18:47 ` laurent at guerby dot net
@ 2005-06-17 15:10 ` pinskia at gcc dot gnu dot org
2005-07-05 8:26 ` laurent at guerby dot net
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-17 15:10 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |alias
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19382
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ada/19382] ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux
2005-01-11 21:10 [Bug ada/19382] New: ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux laurent at guerby dot net
` (3 preceding siblings ...)
2005-06-17 15:10 ` pinskia at gcc dot gnu dot org
@ 2005-07-05 8:26 ` laurent at guerby dot net
2005-09-15 19:17 ` [Bug ada/19382] ACATS cxb4005 cxb5002 simple To_COBOL/To_Fortran " laurent at guerby dot net
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: laurent at guerby dot net @ 2005-07-05 8:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From laurent at guerby dot net 2005-07-05 08:26 -------
Still failing as of 4.0.1 RC3 (20050702)
http://gcc.gnu.org/ml/gcc-testresults/2005-07/msg00183.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19382
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ada/19382] ACATS cxb4005 cxb5002 simple To_COBOL/To_Fortran test fails at runtime on s390-linux
2005-01-11 21:10 [Bug ada/19382] New: ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux laurent at guerby dot net
` (4 preceding siblings ...)
2005-07-05 8:26 ` laurent at guerby dot net
@ 2005-09-15 19:17 ` laurent at guerby dot net
2005-09-15 19:19 ` laurent at guerby dot net
2005-09-29 23:52 ` uweigand at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: laurent at guerby dot net @ 2005-09-15 19:17 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From laurent at guerby dot net 2005-09-15 19:17 -------
On 4.1.0 20050914 on s390-linux, two tests have similar failures:
,.,. CXB4005 ACATS 2.5 05-09-14 20:15:52
---- CXB4005 Check that the functions To_COBOL and To_Ada produce
correct results.
* CXB4005 Incorrect result from function To_COBOL - 1.
* CXB4005 Incorrect result from function To_COBOL after modification
to Ada_To_COBOL mapping array - 1.
**** CXB4005 FAILED ****************************.
,.,. CXB5002 ACATS 2.5 05-09-14 20:15:58
---- CXB5002 Check that functions To_Fortran and To_Ada produce correct
results.
* CXB5002 Incorrect result from procedure To_Fortran - 1.
* CXB5002 Incorrect value returned from function To_Ada - 1.
**** CXB5002 FAILED ****************************.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |uweigand at gcc dot gnu dot
| |org
Summary|ACATS cxb5002 simple |ACATS cxb4005 cxb5002 simple
|To_Fortran test fails at |To_COBOL/To_Fortran test
|runtime on s390-linux |fails at runtime on s390-
| |linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19382
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ada/19382] ACATS cxb4005 cxb5002 simple To_COBOL/To_Fortran test fails at runtime on s390-linux
2005-01-11 21:10 [Bug ada/19382] New: ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux laurent at guerby dot net
` (5 preceding siblings ...)
2005-09-15 19:17 ` [Bug ada/19382] ACATS cxb4005 cxb5002 simple To_COBOL/To_Fortran " laurent at guerby dot net
@ 2005-09-15 19:19 ` laurent at guerby dot net
2005-09-29 23:52 ` uweigand at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: laurent at guerby dot net @ 2005-09-15 19:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From laurent at guerby dot net 2005-09-15 19:19 -------
(In reply to comment #5)
> On 4.1.0 20050914 on s390-linux, two tests have similar failures:
Ooops: 4.0.2 20050913 (prerelease) (since 4.1.0 does not bootstrap because of
PR22533
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19382
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ada/19382] ACATS cxb4005 cxb5002 simple To_COBOL/To_Fortran test fails at runtime on s390-linux
2005-01-11 21:10 [Bug ada/19382] New: ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux laurent at guerby dot net
` (6 preceding siblings ...)
2005-09-15 19:19 ` laurent at guerby dot net
@ 2005-09-29 23:52 ` uweigand at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: uweigand at gcc dot gnu dot org @ 2005-09-29 23:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uweigand at gcc dot gnu dot org 2005-09-29 23:52 -------
I've found some time to look a bit more into this. First of all, here's
a much reduced test case:
procedure CXB4005 is
type Alphanumeric is array (Positive range <>) of Character;
TC_Alphanumeric : Alphanumeric(1..1);
begin
TC_Alphanumeric := "A";
pragma Assert (TC_Alphanumeric = "A");
end CXB4005;
The assertion fails when built with -O2 -gnata.
The comparsion TC_Alphanumeric = "A" gets translated by the front
end into this tree (02.original):
if (VIEW_CONVERT_EXPR<character[1:1]>(tc_alphanumeric) != "A")
which get gimplified into (03.generic):
tc_alphanumeric.0 = (character[1:1] *) &tc_alphanumeric;
tc_alphanumeric.1 = (const <unnamed type> *) tc_alphanumeric.0;
D.388 = *tc_alphanumeric.1;
D.389 = (integer) D.388;
D.390 = (const <unnamed type> *) "A";
D.391 = *D.390;
D.392 = (integer) D.391;
D.393 = D.389 - D.392;
if (D.393 != 0)
This transformation happens because an NE_EXPR of array types
is handled by gimplify_variable_sized_compare, which converts
it into an implicit call to memcmp. This call (with length 1)
is then transformed by fold_builtin_memcmp into the computation
of the difference of the two bytes.
This is done in fold_builtin_memcpy by casting the addresses
to an 'const unsigned char *' and dereferencing that expression,
where that type is constructed as a variant of the predefined
unsigned_char_type_node. (This type shows up in the above
listings as 'const <unnamed type> *'.)
Now, when the so-casted expression is dereferenced, we obviously
get into aliasing issues. This works fine in C-based languages,
because there 'unsigned char' is explicitly allowed to alias any
other type -- the fold_builtin_memcpy code is correct really only
when making that assumption.
However, in Ada there is no such special case, and the Ada hook
for get_alias_set does not handle unsigned_char_type_node at all.
Thus the type gets assigned a fresh alias set (that aliases
nothing at all since the type didn't otherwise occur).
I guess this is really a bug in fold_builtin_memcpy, but I'm not
sure what exactly the proper fix would be. As a workaround, I've
added the "C-style" treatment of 'char' to the Ada get_alias_set,
and this fixes the symptom as well. The patch for this is:
Index: gcc/ada/misc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/misc.c,v
retrieving revision 1.106
diff -c -p -r1.106 misc.c
*** gcc/ada/misc.c 4 Jul 2005 13:27:09 -0000 1.106
--- gcc/ada/misc.c 29 Sep 2005 23:34:18 -0000
*************** gnat_get_alias_set (tree type)
*** 713,718 ****
--- 713,725 ----
return
get_alias_set (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (type)))));
+ /* ??? The middle end occasionally generates 'char' types by itself
+ and implicitly assumes they are allowed to alias everything. One
+ example is fold_builtin_memcmp, causing PR 19382. */
+ if (type == char_type_node
+ || type == signed_char_type_node
+ || type == unsigned_char_type_node)
+ return 0;
return -1;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19382
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-09-29 23:52 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-11 21:10 [Bug ada/19382] New: ACATS cxb5002 simple To_Fortran test fails at runtime on s390-linux laurent at guerby dot net
2005-01-15 0:46 ` [Bug ada/19382] " uweigand at gcc dot gnu dot org
2005-03-17 10:49 ` charlet at gcc dot gnu dot org
2005-03-18 18:47 ` laurent at guerby dot net
2005-06-17 15:10 ` pinskia at gcc dot gnu dot org
2005-07-05 8:26 ` laurent at guerby dot net
2005-09-15 19:17 ` [Bug ada/19382] ACATS cxb4005 cxb5002 simple To_COBOL/To_Fortran " laurent at guerby dot net
2005-09-15 19:19 ` laurent at guerby dot net
2005-09-29 23:52 ` uweigand at gcc dot gnu dot 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).