public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35150] New: [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728
@ 2008-02-09 19:39 burnus at gcc dot gnu dot org
2008-02-09 19:41 ` [Bug fortran/35150] " burnus at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-02-09 19:39 UTC (permalink / raw)
To: gcc-bugs
Working: 2007-07-16-r126671
Failing: 2007-07-19-r126744
Compiling F03GL (http://www-stone.ch.cam.ac.uk/pub/f03gl/,
http://www-stone.ch.cam.ac.uk/pub/f03gl/f03gl.zip) gives the ICE:
gfortran -fno-range-check -DNAGF95 -DOPENGL -c OpenGL_glut.f90
[...]
OpenGL_glut.f90: In function 'glutinit_f03':
OpenGL_glut.f90:1518: internal compiler error: in expand_expr_addr_expr_1, at
expr.c:6835
Test case:
MODULE OpenGL_glut
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
CONTAINS
SUBROUTINE glutInit_gl(pargc, argv) BIND(C,NAME="glutInit")
INTEGER(C_INT) :: pargc
TYPE(C_PTR), INTENT(IN) :: argv
END SUBROUTINE glutInit_gl
SUBROUTINE glutInit_f03()
INTEGER(C_INT) :: argcp=1
TYPE(C_PTR), DIMENSION(1), TARGET :: argv=C_NULL_PTR
CHARACTER(C_CHAR), DIMENSION(1), TARGET :: empty_string=C_NULL_CHAR
CALL glutInit_gl(argcp, C_LOC(argv))
END SUBROUTINE
END MODULE OpenGL_glut
--
Summary: [4.3 Regression] ICE in expand_expr_addr_expr_1, at
expr.c:6728
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: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35150
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/35150] [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728
2008-02-09 19:39 [Bug fortran/35150] New: [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728 burnus at gcc dot gnu dot org
@ 2008-02-09 19:41 ` burnus at gcc dot gnu dot org
2008-02-09 20:34 ` [Bug fortran/35150] " pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-02-09 19:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2008-02-09 19:40 -------
Possible cause for the regression:
r126744 | burnus | 2007-07-19 08:14:19 +0200 (Thu, 19 Jul 2007) | 14 lines
2007-07-19 Christopher D. Rickett <crickett@lanl.gov>
PR fortran/32600
* trans-expr.c (gfc_conv_function_call): Inline C_LOC.
2007-07-19 Christopher D. Rickett <crickett@lanl.gov>
PR fortran/32600
* libgfortran/intrinsics/iso_c_binding.c: Remove C_LOC.
* libgfortran/intrinsics/iso_c_binding.h: Ditto.
* libgfortran/gfortran.map: Ditto.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |crickett at lanl dot gov
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35150
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/35150] ICE in expand_expr_addr_expr_1, at expr.c:6728
2008-02-09 19:39 [Bug fortran/35150] New: [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728 burnus at gcc dot gnu dot org
2008-02-09 19:41 ` [Bug fortran/35150] " burnus at gcc dot gnu dot org
@ 2008-02-09 20:34 ` pinskia at gcc dot gnu dot org
2008-02-09 22:03 ` burnus at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-02-09 20:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-02-09 20:33 -------
How is this a regression? ISO_C_BINDING is new for 4.3.0 :).
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Keywords|rejects-valid |ice-on-valid-code
Summary|[4.3 Regression] ICE in |ICE in
|expand_expr_addr_expr_1, at |expand_expr_addr_expr_1, at
|expr.c:6728 |expr.c:6728
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35150
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/35150] ICE in expand_expr_addr_expr_1, at expr.c:6728
2008-02-09 19:39 [Bug fortran/35150] New: [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728 burnus at gcc dot gnu dot org
2008-02-09 19:41 ` [Bug fortran/35150] " burnus at gcc dot gnu dot org
2008-02-09 20:34 ` [Bug fortran/35150] " pinskia at gcc dot gnu dot org
@ 2008-02-09 22:03 ` burnus at gcc dot gnu dot org
2008-02-09 22:05 ` burnus at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-02-09 22:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from burnus at gcc dot gnu dot org 2008-02-09 22:02 -------
> How is this a regression? ISO_C_BINDING is new for 4.3.0 :).
Well, it is not a regression versus 4.2, but it is nonetheless a regression: It
was working before. How are such regressions marked?
* * *
Simplified test case:
USE ISO_C_BINDING
TYPE(C_PTR), TARGET, SAVE :: argv
INTERFACE
SUBROUTINE glutInit_gl(argv) BIND(C)
import
TYPE(C_PTR) :: argv
END SUBROUTINE glutInit_gl
END INTERFACE
CALL glutInit_gl(C_LOC(argv))
END
Dumped tree:
MAIN__ ()
{
static void * argv;
static integer(kind=4) options.0[7] = {68, 127, 0, 0, 0, 1, 0};
_gfortran_set_options (7, (void *) &options.0);
{
static void * * C.906 = &argv;
glutinit_gl (&C.906);
}
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35150
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/35150] ICE in expand_expr_addr_expr_1, at expr.c:6728
2008-02-09 19:39 [Bug fortran/35150] New: [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728 burnus at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-02-09 22:03 ` burnus at gcc dot gnu dot org
@ 2008-02-09 22:05 ` burnus at gcc dot gnu dot org
2008-02-14 12:43 ` [Bug fortran/35150] ICE in expand_expr_addr_expr_1, at expr.c:6728 (regression vs. earlier 4.3) fxcoudert at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-02-09 22:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from burnus at gcc dot gnu dot org 2008-02-09 22:04 -------
Forget to write that the ICE is gone if one removed the SAVE
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35150
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/35150] ICE in expand_expr_addr_expr_1, at expr.c:6728 (regression vs. earlier 4.3)
2008-02-09 19:39 [Bug fortran/35150] New: [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728 burnus at gcc dot gnu dot org
` (3 preceding siblings ...)
2008-02-09 22:05 ` burnus at gcc dot gnu dot org
@ 2008-02-14 12:43 ` fxcoudert at gcc dot gnu dot org
2008-02-15 9:30 ` jakub at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-02-14 12:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from fxcoudert at gcc dot gnu dot org 2008-02-14 12:42 -------
I've posted a workaround patch at
http://gcc.gnu.org/ml/fortran/2008-02/msg00092.html. My analysis is currently
as follow: we currently have
static void * * C.906 = &argv;
glutinit_gl (&C.906);
which leads to the ICE in expand_expr_addr_expr_1(). The code we emitted
before, when C_LOC wasn't inlined, was:
void * C.906 = _gfortran_c_loc (&argv);
glutinit_gl (&C.906);
where _gfortran_c_loc was effectively:
void * _gfortran_c_loc (void *p) { return p; }
As Tobias shown, the code taking care of taking the adress of argv
(constructing "&argv") is in function gfc_conv_function_call (in trans-expr.c).
I have tried to modify it by forcing a cast to pvoid_type_node, but it still
gets the "static" attribute later. The variable creation is not done in that
function, but later (and I cannot see why). If someone knows where, that would
be great.
PS: I think that translating the ISO_C_BINDING inlined functions in
gfc_conv_function_call() is actually too late. The intrinsic functions, for
example, are intercepted somewhere earlier in the code path, and I think that
would be better to do it in a similar way for intrinsic module functions (now,
ISO_C_BINDING, and later, IEEE_*).
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fxcoudert at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Known to fail| |4.3.0
Last reconfirmed|0000-00-00 00:00:00 |2008-02-14 12:42:39
date| |
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35150
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/35150] ICE in expand_expr_addr_expr_1, at expr.c:6728 (regression vs. earlier 4.3)
2008-02-09 19:39 [Bug fortran/35150] New: [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728 burnus at gcc dot gnu dot org
` (4 preceding siblings ...)
2008-02-14 12:43 ` [Bug fortran/35150] ICE in expand_expr_addr_expr_1, at expr.c:6728 (regression vs. earlier 4.3) fxcoudert at gcc dot gnu dot org
@ 2008-02-15 9:30 ` jakub at gcc dot gnu dot org
2008-02-15 15:25 ` burnus at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-02-15 9:30 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35150
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/35150] ICE in expand_expr_addr_expr_1, at expr.c:6728 (regression vs. earlier 4.3)
2008-02-09 19:39 [Bug fortran/35150] New: [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728 burnus at gcc dot gnu dot org
` (5 preceding siblings ...)
2008-02-15 9:30 ` jakub at gcc dot gnu dot org
@ 2008-02-15 15:25 ` burnus at gcc dot gnu dot org
2008-02-15 16:21 ` fxcoudert at gcc dot gnu dot org
2008-02-15 21:15 ` fxcoudert at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-02-15 15:25 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 730 bytes --]
------- Comment #6 from burnus at gcc dot gnu dot org 2008-02-15 15:24 -------
(In reply to comment #3)
> Simplified test case:
This now works with FX's patch.
However, using F03GL still fails with:
OpenGL_glut.f90: In function glutinit_f03:
OpenGL_glut.f90:1518: internal compiler error: in expand_expr_addr_expr_1, at
expr.c:6835
For a reduced test case see comment 0. For that test case, one has the dump:
glutinit_f03 ()
{
static integer(kind=4) argcp = 1;
static void * argv[1] = {0};
{
static void *[1] * C.910 = &argv;
glutinit_gl (&argcp, &C.910);
}
}
That is, the ELSE branch needs to be fixed as well; the fix was only for rank
== 0.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35150
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/35150] ICE in expand_expr_addr_expr_1, at expr.c:6728 (regression vs. earlier 4.3)
2008-02-09 19:39 [Bug fortran/35150] New: [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728 burnus at gcc dot gnu dot org
` (6 preceding siblings ...)
2008-02-15 15:25 ` burnus at gcc dot gnu dot org
@ 2008-02-15 16:21 ` fxcoudert at gcc dot gnu dot org
2008-02-15 21:15 ` fxcoudert at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-02-15 16:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from fxcoudert at gcc dot gnu dot org 2008-02-15 16:21 -------
(In reply to comment #6)
> That is, the ELSE branch needs to be fixed as well; the fix was only for rank
> == 0.
OK, here is an updated patch:
Index: trans-expr.c
===================================================================
--- trans-expr.c (revision 132257)
+++ trans-expr.c (working copy)
@@ -2264,6 +2264,13 @@
gfc_conv_array_parameter (se, arg->expr, argss, f);
}
+ /* TODO -- the following two lines shouldn't be necessary, but
+ they're removed a bug is exposed later in the codepath.
+ This is workaround was thus introduced, but will have to be
+ removed; please see PR 35150 for details about the issue. */
+ se->expr = convert (pvoid_type_node, se->expr);
+ se->expr = gfc_evaluate_now (se->expr, &se->pre);
+
return 0;
}
else if (sym->intmod_sym_id == ISOCBINDING_FUNLOC)
I've started regtesting and will submit it for review afterwards.
--
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|2008-02-14 12:42:39 |2008-02-15 16:21:02
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35150
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/35150] ICE in expand_expr_addr_expr_1, at expr.c:6728 (regression vs. earlier 4.3)
2008-02-09 19:39 [Bug fortran/35150] New: [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728 burnus at gcc dot gnu dot org
` (7 preceding siblings ...)
2008-02-15 16:21 ` fxcoudert at gcc dot gnu dot org
@ 2008-02-15 21:15 ` fxcoudert at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-02-15 21:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from fxcoudert at gcc dot gnu dot org 2008-02-15 21:15 -------
Fixed on trunk:
Author: fxcoudert
Date: Fri Feb 15 21:12:24 2008
New Revision: 132353
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132353
Log:
* trans-expr.c (gfc_conv_function_call): Force evaluation of
se->expr.
* gfortran.dg/c_loc_tests_12.f03: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/c_loc_tests_12.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog
--
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=35150
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-02-15 21:15 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-09 19:39 [Bug fortran/35150] New: [4.3 Regression] ICE in expand_expr_addr_expr_1, at expr.c:6728 burnus at gcc dot gnu dot org
2008-02-09 19:41 ` [Bug fortran/35150] " burnus at gcc dot gnu dot org
2008-02-09 20:34 ` [Bug fortran/35150] " pinskia at gcc dot gnu dot org
2008-02-09 22:03 ` burnus at gcc dot gnu dot org
2008-02-09 22:05 ` burnus at gcc dot gnu dot org
2008-02-14 12:43 ` [Bug fortran/35150] ICE in expand_expr_addr_expr_1, at expr.c:6728 (regression vs. earlier 4.3) fxcoudert at gcc dot gnu dot org
2008-02-15 9:30 ` jakub at gcc dot gnu dot org
2008-02-15 15:25 ` burnus at gcc dot gnu dot org
2008-02-15 16:21 ` fxcoudert at gcc dot gnu dot org
2008-02-15 21:15 ` 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).