* [Bug fortran/51945] Diagnose wrong default initialization of DTs in a DT declaration
2012-01-22 17:05 [Bug fortran/51945] New: Diagnose wrong default initialization of DTs in a DT declaration burnus at gcc dot gnu.org
@ 2013-08-08 16:49 ` dominiq at lps dot ens.fr
2013-08-08 18:31 ` janus at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-08-08 16:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51945
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-08-08
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Between revisions 194897 (2013-01-04: no error) and 195140 (2013-01-14),
gfortran has started to emit the following error for the original test:
pr51945.f90:14.16:
type(t) :: y = t2() ! Invalid
1
Error: Can't convert TYPE(t2) to TYPE(t) at (1)
If the type-declaration line 'type(my_t) :: a' is uncommented, the errors
appear once for r194897, but twice for r195140.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51945] Diagnose wrong default initialization of DTs in a DT declaration
2012-01-22 17:05 [Bug fortran/51945] New: Diagnose wrong default initialization of DTs in a DT declaration burnus at gcc dot gnu.org
2013-08-08 16:49 ` [Bug fortran/51945] " dominiq at lps dot ens.fr
@ 2013-08-08 18:31 ` janus at gcc dot gnu.org
2013-08-08 18:38 ` janus at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-08 18:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51945
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |janus at gcc dot gnu.org
--- Comment #2 from janus at gcc dot gnu.org ---
With current trunk as well as 4.8, the test case with comment gives me:
Error: Can't convert TYPE(t2) to TYPE(t) at (1)
(but not the corresponding error with 't3'). When uncommenting the line I get:
Error: Can't convert TYPE(t2) to TYPE(t) at (1)
Error: Can't convert TYPE(t2) to TYPE(t) at (1)
Error: Can't convert TYPE(t2) to TYPE(t) at (1)
Error: Can't convert TYPE(t3) to TYPE(t) at (1)
(i.e. three times the error about t2 and once about t3).
I guess the expected result would be to get each error once!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51945] Diagnose wrong default initialization of DTs in a DT declaration
2012-01-22 17:05 [Bug fortran/51945] New: Diagnose wrong default initialization of DTs in a DT declaration burnus at gcc dot gnu.org
2013-08-08 16:49 ` [Bug fortran/51945] " dominiq at lps dot ens.fr
2013-08-08 18:31 ` janus at gcc dot gnu.org
@ 2013-08-08 18:38 ` janus at gcc dot gnu.org
2013-08-08 19:46 ` janus at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-08 18:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51945
--- Comment #3 from janus at gcc dot gnu.org ---
Applying the patches from PR 49213 (comments 8, 10 and 16), I get the
following:
1) test case with comment: same as before (error with t2)
2) test case with uncommented line:
c0.f90:15.16:
type(t) :: y = t2() ! Invalid
1
Error: Can't convert TYPE(t2) to TYPE(t) at (1)
c0.f90:2.6:
type t
1
Internal Error at (1):
c0.f90:15.16:
type(t) :: y = t2() ! Invalid
1
Can't convert TYPE(t2) to TYPE(t) at (1)
As noted by Dominique, this seems to be due to PR 49213 comment 16, in
particular.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51945] Diagnose wrong default initialization of DTs in a DT declaration
2012-01-22 17:05 [Bug fortran/51945] New: Diagnose wrong default initialization of DTs in a DT declaration burnus at gcc dot gnu.org
` (2 preceding siblings ...)
2013-08-08 18:38 ` janus at gcc dot gnu.org
@ 2013-08-08 19:46 ` janus at gcc dot gnu.org
2013-08-08 20:56 ` janus at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-08 19:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51945
--- Comment #4 from janus at gcc dot gnu.org ---
The following patch should somewhat improve the situation:
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 201576)
+++ gcc/fortran/resolve.c (working copy)
@@ -1178,7 +1178,7 @@ resolve_structure_cons (gfc_expr *expr, int init)
gfc_basic_typename (comp->ts.type));
t = false;
}
- else
+ else if (!init)
{
bool t2 = gfc_convert_type (cons->expr, &comp->ts, 1);
if (t)
@@ -12344,7 +12344,7 @@ resolve_fl_derived0 (gfc_symbol *sym)
if (c->initializer && !sym->attr.vtype
&& !gfc_check_assign_symbol (sym, c, c->initializer))
- return false;
+ continue;
}
check_defined_assignments (sym);
The first hunk suppresses the errors in the resolution of the symbol 'a', since
they should already be thrown in the resolution of the type.
The second hunk makes sure one gets the error in both components when resolving
the type (a similar thing is also done in PR 58023 comment 5).
With the above patch I get the expected result on the original test case in
comment 0:
Error: Can't convert TYPE(t2) to TYPE(t) at (1)
Error: Can't convert TYPE(t3) to TYPE(t) at (1)
On the version with the uncommented line, each error unfortunately still
appears twice, but that is due to the fact that the type symbol is resolved
twice (cf. also PR 44978).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51945] Diagnose wrong default initialization of DTs in a DT declaration
2012-01-22 17:05 [Bug fortran/51945] New: Diagnose wrong default initialization of DTs in a DT declaration burnus at gcc dot gnu.org
` (3 preceding siblings ...)
2013-08-08 19:46 ` janus at gcc dot gnu.org
@ 2013-08-08 20:56 ` janus at gcc dot gnu.org
2013-08-08 21:18 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-08 20:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51945
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org
--- Comment #5 from janus at gcc dot gnu.org ---
(In reply to janus from comment #4)
> The following patch should somewhat improve the situation:
... and regtests cleanly.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51945] Diagnose wrong default initialization of DTs in a DT declaration
2012-01-22 17:05 [Bug fortran/51945] New: Diagnose wrong default initialization of DTs in a DT declaration burnus at gcc dot gnu.org
` (4 preceding siblings ...)
2013-08-08 20:56 ` janus at gcc dot gnu.org
@ 2013-08-08 21:18 ` janus at gcc dot gnu.org
2013-08-10 11:28 ` janus at gcc dot gnu.org
2014-05-04 14:02 ` dominiq at lps dot ens.fr
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-08 21:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51945
--- Comment #6 from janus at gcc dot gnu.org ---
Btw, here is a variant which triggers an internal error similar to comment 3,
but already with a clean trunk:
type t
integer :: i = 3
end type t
type my_t
integer :: i = t()
end type
type(my_t) :: a
end
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51945] Diagnose wrong default initialization of DTs in a DT declaration
2012-01-22 17:05 [Bug fortran/51945] New: Diagnose wrong default initialization of DTs in a DT declaration burnus at gcc dot gnu.org
` (5 preceding siblings ...)
2013-08-08 21:18 ` janus at gcc dot gnu.org
@ 2013-08-10 11:28 ` janus at gcc dot gnu.org
2014-05-04 14:02 ` dominiq at lps dot ens.fr
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-10 11:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51945
--- Comment #7 from janus at gcc dot gnu.org ---
(In reply to janus from comment #6)
> Btw, here is a variant which triggers an internal error similar to comment
> 3, but already with a clean trunk:
I guess one could just get rid of the internal error like this:
Index: gcc/fortran/intrinsic.c
===================================================================
--- gcc/fortran/intrinsic.c (revision 201631)
+++ gcc/fortran/intrinsic.c (working copy)
@@ -4430,7 +4430,7 @@ gfc_convert_type (gfc_expr *expr, gfc_typespec *ts
The possible values are:
1 Generate a gfc_error()
- 2 Generate a gfc_internal_error().
+ 2 No error.
'wflag' controls the warning related to conversion. */
@@ -4574,27 +4574,16 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespe
if (gfc_is_constant_expr (expr->value.function.actual->expr)
&& !do_simplify (sym, expr))
- {
+ return false; /* Error already generated in do_simplify() */
- if (eflag == 2)
- goto bad;
- return false; /* Error already generated in do_simplify() */
- }
-
return true;
bad:
if (eflag == 1)
- {
- gfc_error ("Can't convert %s to %s at %L",
- gfc_typename (&from_ts), gfc_typename (ts), &expr->where);
- return false;
- }
+ gfc_error ("Can't convert %s to %s at %L",
+ gfc_typename (&from_ts), gfc_typename (ts), &expr->where);
- gfc_internal_error ("Can't convert %s to %s at %L",
- gfc_typename (&from_ts), gfc_typename (ts),
- &expr->where);
- /* Not reached */
+ return false;
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51945] Diagnose wrong default initialization of DTs in a DT declaration
2012-01-22 17:05 [Bug fortran/51945] New: Diagnose wrong default initialization of DTs in a DT declaration burnus at gcc dot gnu.org
` (6 preceding siblings ...)
2013-08-10 11:28 ` janus at gcc dot gnu.org
@ 2014-05-04 14:02 ` dominiq at lps dot ens.fr
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-05-04 14:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51945
--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I have the patches in comments 4 and 7 for several months. They fix the issues
without regression. Would it helps if I do the packaging?
^ permalink raw reply [flat|nested] 9+ messages in thread