* [PATCH] PR fortran/77372
@ 2016-08-25 22:13 Steve Kargl
2016-08-26 11:02 ` Fritz Reese
2016-08-29 9:10 ` Andreas Schwab
0 siblings, 2 replies; 6+ messages in thread
From: Steve Kargl @ 2016-08-25 22:13 UTC (permalink / raw)
To: fortran, gcc-patches
I plan to commit the following patch on Saturday if
no one objects in the next 40 or so hours.
2016-08-25 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77372
simplify.c (simplify_ieee_selected_real_kind): Check for NULL pointers.
2016-08-25 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77372
gfortran.dg/pr77372.f90: New test.
Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c (revision 239762)
+++ gcc/fortran/simplify.c (working copy)
@@ -7044,9 +7044,19 @@ gfc_simplify_compiler_version (void)
gfc_expr *
simplify_ieee_selected_real_kind (gfc_expr *expr)
{
- gfc_actual_arglist *arg = expr->value.function.actual;
- gfc_expr *p = arg->expr, *q = arg->next->expr,
- *rdx = arg->next->next->expr;
+ gfc_actual_arglist *arg;
+ gfc_expr *p = NULL, *q = NULL, *rdx = NULL;
+
+ arg = expr->value.function.actual;
+ if (arg->expr)
+ p = arg->expr;
+ if (arg->next)
+ {
+ if (arg->next->expr)
+ q = arg->next->expr;
+ if (arg->next->next && arg->next->next->expr)
+ rdx = arg->next->next->expr;
+ }
/* Currently, if IEEE is supported and this module is built, it means
all our floating-point types conform to IEEE. Hence, we simply handle
Index: gcc/testsuite/gfortran.dg/pr77372.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr77372.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr77372.f90 (working copy)
@@ -0,0 +1,7 @@
+! { dg-do compile }
+program p
+ use ieee_arithmetic
+ real(kind=ieee_selected_real_kind(10_1)) :: z1
+ real(kind=ieee_selected_real_kind(10_2)) :: z2
+ real(kind=ieee_selected_real_kind(10_4)) :: z4
+end
--
Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PR fortran/77372
2016-08-25 22:13 [PATCH] PR fortran/77372 Steve Kargl
@ 2016-08-26 11:02 ` Fritz Reese
2016-08-29 9:10 ` Andreas Schwab
1 sibling, 0 replies; 6+ messages in thread
From: Fritz Reese @ 2016-08-26 11:02 UTC (permalink / raw)
To: kargl; +Cc: fortran, gcc-patches
On Thu, Aug 25, 2016 at 6:13 PM, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
> I plan to commit the following patch on Saturday if
> no one objects in the next 40 or so hours.
>
> 2016-08-25 Steven G. Kargl <kargl@gcc.gnu.org>
>
> PR fortran/77372
> simplify.c (simplify_ieee_selected_real_kind): Check for NULL pointers.
>
> 2016-08-25 Steven G. Kargl <kargl@gcc.gnu.org>
>
> PR fortran/77372
> gfortran.dg/pr77372.f90: New test.
>
> Index: gcc/fortran/simplify.c
> ===================================================================
> --- gcc/fortran/simplify.c (revision 239762)
> +++ gcc/fortran/simplify.c (working copy)
> @@ -7044,9 +7044,19 @@ gfc_simplify_compiler_version (void)
> gfc_expr *
> simplify_ieee_selected_real_kind (gfc_expr *expr)
> {
> - gfc_actual_arglist *arg = expr->value.function.actual;
> - gfc_expr *p = arg->expr, *q = arg->next->expr,
> - *rdx = arg->next->next->expr;
> + gfc_actual_arglist *arg;
> + gfc_expr *p = NULL, *q = NULL, *rdx = NULL;
> +
> + arg = expr->value.function.actual;
> + if (arg->expr)
> + p = arg->expr;
> + if (arg->next)
> + {
> + if (arg->next->expr)
> + q = arg->next->expr;
> + if (arg->next->next && arg->next->next->expr)
> + rdx = arg->next->next->expr;
> + }
>
(snip)
Technically there are three superfluous conditions. The following is equivalent:
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 8096a92..a3d42e1 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -7045,8 +7045,15 @@ gfc_expr *
simplify_ieee_selected_real_kind (gfc_expr *expr)
{
- gfc_actual_arglist *arg = expr->value.function.actual;
- gfc_expr *p = arg->expr, *q = arg->next->expr,
- *rdx = arg->next->next->expr;
+ gfc_actual_arglist *arg;
+ gfc_expr *p = NULL, *q = NULL, *rdx = NULL;
+
+ arg = expr->value.function.actual;
+ p = arg->expr;
+ if (arg->next)
+ {
+ q = arg->next->expr;
+ if (arg->next->next)
+ rdx = arg->next->next->expr;
+ }
/* Currently, if IEEE is supported and this module is built, it means
all our floating-point types conform to IEEE. Hence, we simply handle
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PR fortran/77372
2016-08-25 22:13 [PATCH] PR fortran/77372 Steve Kargl
2016-08-26 11:02 ` Fritz Reese
@ 2016-08-29 9:10 ` Andreas Schwab
2016-08-29 15:01 ` Steve Kargl
1 sibling, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2016-08-29 9:10 UTC (permalink / raw)
To: Steve Kargl; +Cc: fortran, gcc-patches, kargl
On Aug 26 2016, Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
> 2016-08-25 Steven G. Kargl <kargl@gcc.gnu.org>
>
> PR fortran/77372
> gfortran.dg/pr77372.f90: New test.
FAIL: gfortran.dg/pr77372.f90 -O (test for excess errors)
Excess errors:
/usr/local/gcc/gcc-20160829/gcc/testsuite/gfortran.dg/pr77372.f90:3:7: Fatal Error: Can't open module file 'ieee_arithmetic.mod' for reading at (1): No such file or directory
compilation terminated.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PR fortran/77372
2016-08-29 9:10 ` Andreas Schwab
@ 2016-08-29 15:01 ` Steve Kargl
2016-08-29 15:10 ` Andreas Schwab
0 siblings, 1 reply; 6+ messages in thread
From: Steve Kargl @ 2016-08-29 15:01 UTC (permalink / raw)
To: Andreas Schwab; +Cc: fortran, gcc-patches, kargl
On Mon, Aug 29, 2016 at 11:10:41AM +0200, Andreas Schwab wrote:
> On Aug 26 2016, Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
>
> > 2016-08-25 Steven G. Kargl <kargl@gcc.gnu.org>
> >
> > PR fortran/77372
> > gfortran.dg/pr77372.f90: New test.
>
> FAIL: gfortran.dg/pr77372.f90 -O (test for excess errors)
> Excess errors:
> /usr/local/gcc/gcc-20160829/gcc/testsuite/gfortran.dg/pr77372.f90:3:7: Fatal Error: Can't open module file 'ieee_arithmetic.mod' for reading at (1): No such file or directory
> compilation terminated.
>
Does it FAIL if you move the test into the gfortran.dg/ieee
directory?
--
Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PR fortran/77372
2016-08-29 15:01 ` Steve Kargl
@ 2016-08-29 15:10 ` Andreas Schwab
2016-08-29 16:27 ` Steven G. Kargl
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2016-08-29 15:10 UTC (permalink / raw)
To: Steve Kargl; +Cc: fortran, gcc-patches, kargl
On Aug 29 2016, Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
> On Mon, Aug 29, 2016 at 11:10:41AM +0200, Andreas Schwab wrote:
>> On Aug 26 2016, Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
>>
>> > 2016-08-25 Steven G. Kargl <kargl@gcc.gnu.org>
>> >
>> > PR fortran/77372
>> > gfortran.dg/pr77372.f90: New test.
>>
>> FAIL: gfortran.dg/pr77372.f90 -O (test for excess errors)
>> Excess errors:
>> /usr/local/gcc/gcc-20160829/gcc/testsuite/gfortran.dg/pr77372.f90:3:7: Fatal Error: Can't open module file 'ieee_arithmetic.mod' for reading at (1): No such file or directory
>> compilation terminated.
>>
>
> Does it FAIL if you move the test into the gfortran.dg/ieee
> directory?
With that change it passes.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PR fortran/77372
2016-08-29 15:10 ` Andreas Schwab
@ 2016-08-29 16:27 ` Steven G. Kargl
0 siblings, 0 replies; 6+ messages in thread
From: Steven G. Kargl @ 2016-08-29 16:27 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Steve Kargl, fortran, gcc-patches, kargl
On Mon, Aug 29, 2016 at 05:09:59PM +0200, Andreas Schwab wrote:
> On Aug 29 2016, Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
>
> > On Mon, Aug 29, 2016 at 11:10:41AM +0200, Andreas Schwab wrote:
> >> On Aug 26 2016, Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
> >>
> >> > 2016-08-25 Steven G. Kargl <kargl@gcc.gnu.org>
> >> >
> >> > PR fortran/77372
> >> > gfortran.dg/pr77372.f90: New test.
> >>
> >> FAIL: gfortran.dg/pr77372.f90 -O (test for excess errors)
> >> Excess errors:
> >> /usr/local/gcc/gcc-20160829/gcc/testsuite/gfortran.dg/pr77372.f90:3:7: Fatal Error: Can't open module file 'ieee_arithmetic.mod' for reading at (1): No such file or directory
> >> compilation terminated.
> >>
> >
> > Does it FAIL if you move the test into the gfortran.dg/ieee
> > directory?
>
> With that change it passes.
Thanks for checking. Seems that some targets need
ieee.exp to set up the path correctly. I'll move
the test shortly.
--
steve
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-08-29 16:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-25 22:13 [PATCH] PR fortran/77372 Steve Kargl
2016-08-26 11:02 ` Fritz Reese
2016-08-29 9:10 ` Andreas Schwab
2016-08-29 15:01 ` Steve Kargl
2016-08-29 15:10 ` Andreas Schwab
2016-08-29 16:27 ` Steven G. Kargl
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).