public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31764] New: [f2003] ice in new_line if used as elemental function
@ 2007-04-30 13:56 dfranke at gcc dot gnu dot org
2007-04-30 14:43 ` [Bug fortran/31764] " burnus at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-04-30 13:56 UTC (permalink / raw)
To: gcc-bugs
F2003, 13.7.85, NEW_LINE, Argument:
A shall be of type character. It may be a scalar or an array.
$> cat newline.f90
WRITE(*,*) NEW_LINE((/'a', 'b', 'c'/))
END
$> gfortran-svn -g -Wall newline.f90 && ./a.out
newline.f90: In function 'MAIN__':
newline.f90:1: internal compiler error: in gfc_conv_intrinsic_function, at
fortran/trans-intrinsic.c:3567
$> gfortran-svn -v
gcc version 4.3.0 20070428 (experimental)
--
Summary: [f2003] ice in new_line if used as elemental function
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dfranke at gcc dot gnu dot org
OtherBugsDependingO 20585
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31764
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/31764] [f2003] ice in new_line if used as elemental function
2007-04-30 13:56 [Bug fortran/31764] New: [f2003] ice in new_line if used as elemental function dfranke at gcc dot gnu dot org
@ 2007-04-30 14:43 ` burnus at gcc dot gnu dot org
2007-05-04 11:52 ` [Bug fortran/31764] NEW_LINE with array argument fxcoudert at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-04-30 14:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2007-04-30 15:43 -------
> F2003, 13.7.85, NEW_LINE, Argument:
> A shall be of type character. It may be a scalar or an array.
Additional information:
Class. Inquiry function.
Result Characteristics. Character scalar of length one with the same kind type
parameter as A.
I.e. no array should be returned! This is different to the elemental functions
achar, iachar etc.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-04-30 15:43:12
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31764
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/31764] NEW_LINE with array argument
2007-04-30 13:56 [Bug fortran/31764] New: [f2003] ice in new_line if used as elemental function dfranke at gcc dot gnu dot org
2007-04-30 14:43 ` [Bug fortran/31764] " burnus at gcc dot gnu dot org
@ 2007-05-04 11:52 ` fxcoudert at gcc dot gnu dot org
2007-05-06 14:23 ` fxcoudert at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-05-04 11:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from fxcoudert at gcc dot gnu dot org 2007-05-04 12:52 -------
(Side note: NEW_LINE is not an elemental function. It can be used with an array
argument, but it's different from being elemental.)
As for the bug itself, there's no reason that the argument to NEW_LINE should
be constant: the only requirement is that it's of character kind (all that is
used in NEW_LINE is the character kind, which is always known at compile-time).
So, the following patch fixes it, and I believe it does the right thing:
Index: simplify.c
===================================================================
--- simplify.c (revision 124415)
+++ simplify.c (working copy)
@@ -2641,13 +2641,8 @@ gfc_simplify_new_line (gfc_expr *e)
{
gfc_expr *result;
- if (e->expr_type != EXPR_CONSTANT)
- return NULL;
-
result = gfc_constant_result (BT_CHARACTER, e->ts.kind, &e->where);
-
result->value.character.string = gfc_getmem (2);
-
result->value.character.length = 1;
result->value.character.string[0] = '\n';
result->value.character.string[1] = '\0'; /* For debugger */
This patch is donated to whomever has time to confirm that it does what it
should, that it conforms to the standard and that it regtests. (I'll take care
of it next week if noone has time before then.) The following testcase now
passes:
$ cat a.f90
character(len=10) :: a1
character(len=10) :: a2(2)
character(len=10), parameter :: a3 = "1234567890"
character(len=10), parameter :: a4(2) = "1234567890"
character(len=10), parameter :: a5(2) = repeat("1234567890",2)
print *, ichar(new_line(a1))
print *, ichar(new_line(a2))
print *, ichar(new_line(a3))
print *, ichar(new_line(a4))
print *, ichar(new_line(a5))
end
$ gfortran a.f90 && ./a.out
10
10
10
10
10
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fxcoudert at gcc dot gnu dot
| |org
Keywords| |patch
Known to fail| |4.3.0
Last reconfirmed|2007-04-30 15:43:12 |2007-05-04 12:52:17
date| |
Summary|[f2003] ice in new_line if |NEW_LINE with array argument
|used as elemental function |
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31764
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/31764] NEW_LINE with array argument
2007-04-30 13:56 [Bug fortran/31764] New: [f2003] ice in new_line if used as elemental function dfranke at gcc dot gnu dot org
2007-04-30 14:43 ` [Bug fortran/31764] " burnus at gcc dot gnu dot org
2007-05-04 11:52 ` [Bug fortran/31764] NEW_LINE with array argument fxcoudert at gcc dot gnu dot org
@ 2007-05-06 14:23 ` fxcoudert at gcc dot gnu dot org
2007-05-06 22:57 ` fxcoudert at gcc dot gnu dot org
2007-05-06 22:57 ` fxcoudert at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-05-06 14:23 UTC (permalink / raw)
To: gcc-bugs
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2007-05-04 12:52:17 |2007-05-06 15:22:57
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31764
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/31764] NEW_LINE with array argument
2007-04-30 13:56 [Bug fortran/31764] New: [f2003] ice in new_line if used as elemental function dfranke at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-05-06 22:57 ` fxcoudert at gcc dot gnu dot org
@ 2007-05-06 22:57 ` fxcoudert at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-05-06 22:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from fxcoudert at gcc dot gnu dot org 2007-05-06 23:57 -------
Subject: Bug 31764
Author: fxcoudert
Date: Sun May 6 22:56:52 2007
New Revision: 124482
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124482
Log:
PR fortran/31764
* simplify.c (gfc_simplify_new_line): NEW_LINE can be simplified
even for non constant arguments.
* gfortran.dg/new_line.f90: Add new checks.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/simplify.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/new_line.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31764
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/31764] NEW_LINE with array argument
2007-04-30 13:56 [Bug fortran/31764] New: [f2003] ice in new_line if used as elemental function dfranke at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-05-06 14:23 ` fxcoudert at gcc dot gnu dot org
@ 2007-05-06 22:57 ` fxcoudert at gcc dot gnu dot org
2007-05-06 22:57 ` fxcoudert at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-05-06 22:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from fxcoudert at gcc dot gnu dot org 2007-05-06 23:57 -------
Fixed on mainline.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31764
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-05-06 22:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-30 13:56 [Bug fortran/31764] New: [f2003] ice in new_line if used as elemental function dfranke at gcc dot gnu dot org
2007-04-30 14:43 ` [Bug fortran/31764] " burnus at gcc dot gnu dot org
2007-05-04 11:52 ` [Bug fortran/31764] NEW_LINE with array argument fxcoudert at gcc dot gnu dot org
2007-05-06 14:23 ` fxcoudert at gcc dot gnu dot org
2007-05-06 22:57 ` fxcoudert at gcc dot gnu dot org
2007-05-06 22:57 ` 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).