public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30389] New: ACHAR() intrinsic gives erroneous errors in constant-folding.
@ 2007-01-06 1:55 brooks at gcc dot gnu dot org
2007-01-06 2:12 ` [Bug fortran/30389] " jvdelisle at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: brooks at gcc dot gnu dot org @ 2007-01-06 1:55 UTC (permalink / raw)
To: gcc-bugs
According to the Fortran 95 standard, the result of ACHAR(I) for I not in the
range of 0 to 127 is "processor-dependent". This implies that it _has_ a
result, and thus that it is legal code. However, consider the following
result:
------------------------------------------------------------------------
debian-gfortran:~/test> cat achar.f90
write(*,*) achar(154)
end
debian-gfortran:~/test> ../bin-trunk/bin/gfortran achar.f90
achar.f90:1.17:
write(*,*) achar(154)
1
Error: Extended ASCII not implemented: argument of ACHAR at (1) must be between
0 and 127
------------------------------------------------------------------------
This error is erroneous, and should be removed and a valid result of some sort
should be substituted.
(I will further note that this is inconsistent with what happens when the
ACHAR() call is not constant-folded. It appears that, when the call is not
constant-folded, the result is simply that the least-significant 8 bits of I
are copied into the character.)
--
Summary: ACHAR() intrinsic gives erroneous errors in constant-
folding.
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: brooks at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30389
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30389] ACHAR() intrinsic gives erroneous errors in constant-folding.
2007-01-06 1:55 [Bug fortran/30389] New: ACHAR() intrinsic gives erroneous errors in constant-folding brooks at gcc dot gnu dot org
@ 2007-01-06 2:12 ` jvdelisle at gcc dot gnu dot org
2007-01-11 20:55 ` tkoenig at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-06 2:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jvdelisle at gcc dot gnu dot org 2007-01-06 02:11 -------
I can see where one could interpret the word 'result' to mean an action as
opposed to a value returned. In that sense, its not an error to return an
error.
Still I think it would be best to do the natural thing and return the
equivalent 8 bits.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30389
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30389] ACHAR() intrinsic gives erroneous errors in constant-folding.
2007-01-06 1:55 [Bug fortran/30389] New: ACHAR() intrinsic gives erroneous errors in constant-folding brooks at gcc dot gnu dot org
2007-01-06 2:12 ` [Bug fortran/30389] " jvdelisle at gcc dot gnu dot org
@ 2007-01-11 20:55 ` tkoenig at gcc dot gnu dot org
2007-01-19 21:35 ` tkoenig at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-01-11 20:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from tkoenig at gcc dot gnu dot org 2007-01-11 20:55 -------
We should be consistent to
program main
integer :: i
i = 154
print *,achar(i)
end program main
Confirmed. I'll do this.
--
tkoenig at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |tkoenig at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-01-11 20:55:42
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30389
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30389] ACHAR() intrinsic gives erroneous errors in constant-folding.
2007-01-06 1:55 [Bug fortran/30389] New: ACHAR() intrinsic gives erroneous errors in constant-folding brooks at gcc dot gnu dot org
2007-01-06 2:12 ` [Bug fortran/30389] " jvdelisle at gcc dot gnu dot org
2007-01-11 20:55 ` tkoenig at gcc dot gnu dot org
@ 2007-01-19 21:35 ` tkoenig at gcc dot gnu dot org
2007-01-22 20:35 ` patchapp at dberlin dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-01-19 21:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from tkoenig at gcc dot gnu dot org 2007-01-19 21:35 -------
In order to fix this, we should know what we would prefer :-)
Constant folding maps a lot of characters (all ASCII
characters > 127, and a lot of control characters) to zero.
In the rest of the library, we treat the A* functions identically
to the non-ASCII versions. For example, we encode
subroutine comp(a, b, t)
implicit none
logical t
character(*) a, b
t = lle(a,b)
end
as
comp (a, b, t, _a, _b)
{
bit_size_type D.994;
<unnamed type> D.995;
bit_size_type D.996;
<unnamed type> D.997;
D.994 = (bit_size_type) (<unnamed type>) _a * 8;
D.995 = (<unnamed type>) _a;
D.996 = (bit_size_type) (<unnamed type>) _b * 8;
D.997 = (<unnamed type>) _b;
*t = _gfortran_compare_string (_a, a, _b, b) <= 0;
}
We also encode
program main
integer i
character(1) c
i = 154
c = achar(i)
end
as
i = 154;
{
char char.0;
char.0 = (char) i;
c[1]{lb: 1 sz: 1} = char.0;
}
So, we could either
a) fix constant folding to ignore the ascii_table and xascii_table
b) fix the library and runtime conversion to honor the ascii_table.
a) is perfectly fine, as long as we document it. I'd vote for it.
Comments?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30389
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30389] ACHAR() intrinsic gives erroneous errors in constant-folding.
2007-01-06 1:55 [Bug fortran/30389] New: ACHAR() intrinsic gives erroneous errors in constant-folding brooks at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-01-19 21:35 ` tkoenig at gcc dot gnu dot org
@ 2007-01-22 20:35 ` patchapp at dberlin dot org
2007-01-27 16:35 ` patchapp at dberlin dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: patchapp at dberlin dot org @ 2007-01-22 20:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from patchapp at dberlin dot org 2007-01-22 20:35 -------
Subject: Bug number PR 30389
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01808.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30389
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30389] ACHAR() intrinsic gives erroneous errors in constant-folding.
2007-01-06 1:55 [Bug fortran/30389] New: ACHAR() intrinsic gives erroneous errors in constant-folding brooks at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-01-22 20:35 ` patchapp at dberlin dot org
@ 2007-01-27 16:35 ` patchapp at dberlin dot org
2007-01-28 10:45 ` tkoenig at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: patchapp at dberlin dot org @ 2007-01-27 16:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from patchapp at dberlin dot org 2007-01-27 16:35 -------
Subject: Bug number PR 30389
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg02245.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30389
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30389] ACHAR() intrinsic gives erroneous errors in constant-folding.
2007-01-06 1:55 [Bug fortran/30389] New: ACHAR() intrinsic gives erroneous errors in constant-folding brooks at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-01-27 16:35 ` patchapp at dberlin dot org
@ 2007-01-28 10:45 ` tkoenig at gcc dot gnu dot org
2007-02-07 8:14 ` [Bug fortran/30389] [4.2, 4.1 only] " fxcoudert at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-01-28 10:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from tkoenig at gcc dot gnu dot org 2007-01-28 10:45 -------
Subject: Bug 30389
Author: tkoenig
Date: Sun Jan 28 10:44:47 2007
New Revision: 121255
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121255
Log:
2007-01-28 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/30389
* gfortran.h: Remove gfc_simplify_init_1.
* arith.h: Remove third argument from gfc_compare_string.
* arith.c(gfc_compare_expression): Remove third argument
from call to gfc_compare_string.
(gfc_compare_string): Remove third argument xcoll_table.
Remove use of xcoll_table.
* misc.c(gfc_init_1): Remove call to gfc_simplify_init_1.
* simplify.c(ascii_table): Remove.
(xascii_table): Likewise.
(gfc_simplify_achar): ICE if extract_int fails. Remove use of
ascii_table. Warn if -Wsurprising and value < 0 or > 127.
(gfc_simplify_char): ICE if extract_int fails. Error if
value < 0 or value > 255.
(gfc_simplify_iachar): Remove use of xascii_table.
Char values outside of 0..255 are an ICE.
(gfc_simplify_lge): Remove use of xascii_table.
(gfc_simplify_lgt): Likewise.
(gfc_simplify_lle): Likewise.
(gfc_simplify_llt): Likewise.
(invert_table): Remove.
(gfc_simplify_init_1): Remove.
2007-01-28 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/30389
* gfortran.dg/achar_2.f90: New test.
* gfortran.dg/achar_3.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/achar_2.f90
trunk/gcc/testsuite/gfortran.dg/achar_3.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/arith.c
trunk/gcc/fortran/arith.h
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/misc.c
trunk/gcc/fortran/simplify.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30389
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30389] [4.2, 4.1 only] ACHAR() intrinsic gives erroneous errors in constant-folding.
2007-01-06 1:55 [Bug fortran/30389] New: ACHAR() intrinsic gives erroneous errors in constant-folding brooks at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-01-28 10:45 ` tkoenig at gcc dot gnu dot org
@ 2007-02-07 8:14 ` fxcoudert at gcc dot gnu dot org
2007-02-16 12:20 ` fxcoudert at gcc dot gnu dot org
2007-02-16 15:56 ` [Bug fortran/30389] [4.1 " fxcoudert at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-02-07 8:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from fxcoudert at gcc dot gnu dot org 2007-02-07 08:14 -------
Time for a 4.2 backport?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30389
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30389] [4.2, 4.1 only] ACHAR() intrinsic gives erroneous errors in constant-folding.
2007-01-06 1:55 [Bug fortran/30389] New: ACHAR() intrinsic gives erroneous errors in constant-folding brooks at gcc dot gnu dot org
` (6 preceding siblings ...)
2007-02-07 8:14 ` [Bug fortran/30389] [4.2, 4.1 only] " fxcoudert at gcc dot gnu dot org
@ 2007-02-16 12:20 ` fxcoudert at gcc dot gnu dot org
2007-02-16 15:56 ` [Bug fortran/30389] [4.1 " fxcoudert at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-02-16 12:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from fxcoudert at gcc dot gnu dot org 2007-02-16 12:19 -------
Subject: Bug 30389
Author: fxcoudert
Date: Fri Feb 16 12:19:01 2007
New Revision: 122039
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122039
Log:
2007-02-16 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/30720
* trans-array.c (gfc_trans_create_temp_array): Remove use of the
function argument. Always generate code for negative extent.
Simplify said code.
* trans-array.h (gfc_trans_create_temp_array): Change prototype.
* trans-expr.c (gfc_conv_function_call): Remove use of last argument
of gfc_trans_create_temp_array.
* trans-intrinsic.c (gfc_conv_intrinsic_array_transfer): Likewise.
* trans-stmt.c (gfc_conv_elemental_dependencies): Likewise.
2007-02-16 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/30611
* trans-intrinsic.c (gfc_conv_intrinsic_repeat): Evaluate
arguments only once. Generate check that NCOPIES argument is not
negative.
2007-02-16 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/30389
* gfortran.h: Remove gfc_simplify_init_1.
* arith.h: Remove third argument from gfc_compare_string.
* arith.c(gfc_compare_expression): Remove third argument
from call to gfc_compare_string.
(gfc_compare_string): Remove third argument xcoll_table.
Remove use of xcoll_table.
* misc.c(gfc_init_1): Remove call to gfc_simplify_init_1.
* simplify.c(ascii_table): Remove.
(xascii_table): Likewise.
(gfc_simplify_achar): ICE if extract_int fails. Remove use of
ascii_table. Warn if -Wsurprising and value < 0 or > 127.
(gfc_simplify_char): ICE if extract_int fails. Error if
value < 0 or value > 255.
(gfc_simplify_iachar): Remove use of xascii_table.
Char values outside of 0..255 are an ICE.
(gfc_simplify_lge): Remove use of xascii_table.
(gfc_simplify_lgt): Likewise.
(gfc_simplify_lle): Likewise.
(gfc_simplify_llt): Likewise.
(invert_table): Remove.
(gfc_simplify_init_1): Remove.
2007-02-16 Brooks Moses <brooks.moses@codesourcery.com>
PR 30381
PR 30420
* simplify.c (convert_mpz_to_unsigned): New function.
(convert_mpz_to_signed): New function, largely based on
twos_complement().
(twos_complement): Removed.
(gfc_simplify_ibclr): Add conversions to and from an
unsigned representation before bit-twiddling.
(gfc_simplify_ibset): Same.
(gfc_simplify_ishftc): Add checks for overly large
constant arguments, only check the third argument if
it's present, carry over high bits into the result as
appropriate, and perform the final conversion back to
a signed representation using the correct sign bit.
(gfc_simplify_not): Removed unnecessary masking.
2007-02-16 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/30720
* gfortran.dg/array_function_1.f90: New test.
2007-02-16 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/30611
* gcc/testsuite/gfortran.dg/repeat_1.f90: New test.
2007-02-16 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/30389
* gfortran.dg/achar_2.f90: New test.
* gfortran.dg/achar_3.f90: New test.
2007-02-16 Brooks Moses <brooks.moses@codesourcery.com>
* gfortran.dg/chkbits.f90: Added IBCLR tests; test calls
for different integer kinds.
* gfortran.dg/ishft.f90: Renamed to ishft_1.f90...
* gfortran.dg/ishft_1.f90: ...Renamed from ishft.f90.
* gfortran.dg/ishft_2.f90: New test.
* gfortran.dg/ishft_3.f90: New test.
2007-02-16 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/30611
* intrinsics/string_intrinsics.c (string_repeat): Don't check
if ncopies is negative.
Added:
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/achar_2.f90
- copied unchanged from r121255,
trunk/gcc/testsuite/gfortran.dg/achar_2.f90
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/achar_3.f90
- copied unchanged from r121255,
trunk/gcc/testsuite/gfortran.dg/achar_3.f90
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/array_function_1.f90
- copied unchanged from r121773,
trunk/gcc/testsuite/gfortran.dg/array_function_1.f90
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/ishft_1.f90
- copied unchanged from r120634,
trunk/gcc/testsuite/gfortran.dg/ishft_1.f90
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/ishft_2.f90
- copied unchanged from r120634,
trunk/gcc/testsuite/gfortran.dg/ishft_2.f90
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/ishft_3.f90
- copied unchanged from r120634,
trunk/gcc/testsuite/gfortran.dg/ishft_3.f90
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/repeat_1.f90
- copied unchanged from r121581,
trunk/gcc/testsuite/gfortran.dg/repeat_1.f90
Removed:
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/ishft.f90
Modified:
branches/gcc-4_2-branch/gcc/fortran/ChangeLog
branches/gcc-4_2-branch/gcc/fortran/arith.c
branches/gcc-4_2-branch/gcc/fortran/arith.h
branches/gcc-4_2-branch/gcc/fortran/gfortran.h
branches/gcc-4_2-branch/gcc/fortran/misc.c
branches/gcc-4_2-branch/gcc/fortran/simplify.c
branches/gcc-4_2-branch/gcc/fortran/trans-array.c
branches/gcc-4_2-branch/gcc/fortran/trans-array.h
branches/gcc-4_2-branch/gcc/fortran/trans-expr.c
branches/gcc-4_2-branch/gcc/fortran/trans-intrinsic.c
branches/gcc-4_2-branch/gcc/fortran/trans-stmt.c
branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/chkbits.f90
branches/gcc-4_2-branch/libgfortran/ChangeLog
branches/gcc-4_2-branch/libgfortran/intrinsics/string_intrinsics.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30389
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30389] [4.1 only] ACHAR() intrinsic gives erroneous errors in constant-folding.
2007-01-06 1:55 [Bug fortran/30389] New: ACHAR() intrinsic gives erroneous errors in constant-folding brooks at gcc dot gnu dot org
` (7 preceding siblings ...)
2007-02-16 12:20 ` fxcoudert at gcc dot gnu dot org
@ 2007-02-16 15:56 ` fxcoudert at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-02-16 15:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from fxcoudert at gcc dot gnu dot org 2007-02-16 15:56 -------
Fixed on mainline and 4.2. Unless you really want to backport it to 4.1.3, I'm
closing this bug.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to fail|4.2.0 |
Known to work|4.3.0 |4.3.0 4.2.0
Resolution| |FIXED
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30389
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-02-16 15:56 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-06 1:55 [Bug fortran/30389] New: ACHAR() intrinsic gives erroneous errors in constant-folding brooks at gcc dot gnu dot org
2007-01-06 2:12 ` [Bug fortran/30389] " jvdelisle at gcc dot gnu dot org
2007-01-11 20:55 ` tkoenig at gcc dot gnu dot org
2007-01-19 21:35 ` tkoenig at gcc dot gnu dot org
2007-01-22 20:35 ` patchapp at dberlin dot org
2007-01-27 16:35 ` patchapp at dberlin dot org
2007-01-28 10:45 ` tkoenig at gcc dot gnu dot org
2007-02-07 8:14 ` [Bug fortran/30389] [4.2, 4.1 only] " fxcoudert at gcc dot gnu dot org
2007-02-16 12:20 ` fxcoudert at gcc dot gnu dot org
2007-02-16 15:56 ` [Bug fortran/30389] [4.1 " fxcoudert 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).