diff mbox series

Fix -fdec simplification (PR fortran/88649).

Message ID c9792902-ce25-30bc-6056-05697ec5469d@suse.cz
State New
Headers show
Series Fix -fdec simplification (PR fortran/88649). | expand

Commit Message

Martin Liška Feb. 4, 2019, 9:56 a.m. UTC
Hi.

Starting from r266926 'switch (e->value.op.op)' is reached when
one using -fdec. That's wrong as -fdec causes to create a e->value.function.
I hope the proper fix is to skip the mentioned patch and allow simplification
at the end of the function?

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/fortran/ChangeLog:

2019-01-25  Martin Liska  <mliska@suse.cz>

	PR fortran/88649
	* resolve.c (resolve_operator): Initialize 't' right
	after function entry.  Skip switch (e->value.op.op)
	for -fdec operands that become function calls.
---
 gcc/fortran/resolve.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Martin Liška Feb. 4, 2019, 12:46 p.m. UTC | #1
On 2/4/19 10:56 AM, Martin Liška wrote:
> Hi.
> 
> Starting from r266926 'switch (e->value.op.op)' is reached when
> one using -fdec. That's wrong as -fdec causes to create a e->value.function.
> I hope the proper fix is to skip the mentioned patch and allow simplification
> at the end of the function?
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gcc/fortran/ChangeLog:
> 
> 2019-01-25  Martin Liska  <mliska@suse.cz>
> 
> 	PR fortran/88649
> 	* resolve.c (resolve_operator): Initialize 't' right
> 	after function entry.  Skip switch (e->value.op.op)
> 	for -fdec operands that become function calls.
> ---
>  gcc/fortran/resolve.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> 

I forgot to include fortran ML.

Martin
Martin Liška Feb. 13, 2019, 6:22 a.m. UTC | #2
PING^1.

On 2/4/19 1:46 PM, Martin Liška wrote:
> On 2/4/19 10:56 AM, Martin Liška wrote:
>> Hi.
>>
>> Starting from r266926 'switch (e->value.op.op)' is reached when
>> one using -fdec. That's wrong as -fdec causes to create a e->value.function.
>> I hope the proper fix is to skip the mentioned patch and allow simplification
>> at the end of the function?
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> Ready to be installed?
>> Thanks,
>> Martin
>>
>> gcc/fortran/ChangeLog:
>>
>> 2019-01-25  Martin Liska  <mliska@suse.cz>
>>
>> 	PR fortran/88649
>> 	* resolve.c (resolve_operator): Initialize 't' right
>> 	after function entry.  Skip switch (e->value.op.op)
>> 	for -fdec operands that become function calls.
>> ---
>>  gcc/fortran/resolve.c | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>>
> 
> I forgot to include fortran ML.
> 
> Martin
>
Jerry DeLisle Feb. 13, 2019, 12:42 p.m. UTC | #3
On 2/12/19 10:22 PM, Martin Liška wrote:
> PING^1.
> 
> On 2/4/19 1:46 PM, Martin Liška wrote:
>> On 2/4/19 10:56 AM, Martin Liška wrote:
>>> Hi.
>>>
>>> Starting from r266926 'switch (e->value.op.op)' is reached when
>>> one using -fdec. That's wrong as -fdec causes to create a e->value.function.
>>> I hope the proper fix is to skip the mentioned patch and allow simplification
>>> at the end of the function?
>>>
>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>
>>> Ready to be installed?
>>> Thanks,
>>> Martin
>>>


Yes, OK



>>> gcc/fortran/ChangeLog:
>>>
>>> 2019-01-25  Martin Liska  <mliska@suse.cz>
>>>
>>> 	PR fortran/88649
>>> 	* resolve.c (resolve_operator): Initialize 't' right
>>> 	after function entry.  Skip switch (e->value.op.op)
>>> 	for -fdec operands that become function calls.
>>> ---
>>>   gcc/fortran/resolve.c | 10 +++++-----
>>>   1 file changed, 5 insertions(+), 5 deletions(-)
>>>
>>>
>>
>> I forgot to include fortran ML.
>>
>> Martin
>>
> 
>
diff mbox series

Patch

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 2c49aeab5f9..02dfbb8c56d 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -3880,7 +3880,7 @@  resolve_operator (gfc_expr *e)
   gfc_expr *op1, *op2;
   char msg[200];
   bool dual_locus_error;
-  bool t;
+  bool t = true;
 
   /* Resolve all subnodes-- give them types.  */
 
@@ -4002,7 +4002,7 @@  resolve_operator (gfc_expr *e)
 	  if (op2->ts.type != e->ts.type || op2->ts.kind != e->ts.kind)
 	    gfc_convert_type (op2, &e->ts, 1);
 	  e = logical_to_bitwise (e);
-	  break;
+	  goto simplify_op;
 	}
 
       sprintf (msg, _("Operands of logical operator %%<%s%%> at %%L are %s/%s"),
@@ -4018,7 +4018,7 @@  resolve_operator (gfc_expr *e)
 	  e->ts.type = BT_INTEGER;
 	  e->ts.kind = op1->ts.kind;
 	  e = logical_to_bitwise (e);
-	  break;
+	  goto simplify_op;
 	}
 
       if (op1->ts.type == BT_LOGICAL)
@@ -4143,8 +4143,6 @@  resolve_operator (gfc_expr *e)
 
   /* Deal with arrayness of an operand through an operator.  */
 
-  t = true;
-
   switch (e->value.op.op)
     {
     case INTRINSIC_PLUS:
@@ -4234,6 +4232,8 @@  resolve_operator (gfc_expr *e)
       break;
     }
 
+simplify_op:
+
   /* Attempt to simplify the expression.  */
   if (t)
     {