public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98948] New: unexpected error in procedure pointer initialization or assignment with intrinsic
@ 2021-02-03 3:37 xiao.liu@compiler-dev.com
2021-02-03 7:00 ` [Bug fortran/98948] " kargl at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: xiao.liu@compiler-dev.com @ 2021-02-03 3:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98948
Bug ID: 98948
Summary: unexpected error in procedure pointer initialization
or assignment with intrinsic
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: xiao.liu@compiler-dev.com
Target Milestone: ---
the test case is:
program test
implicit none
procedure(real*4), pointer :: pf => ABS
print *, pf(-6.5_4)
if(pf(-6.5_4) /= ABS(-6.5_4)) STOP 1
pf => ACOS
print *, pf(0.54030231_4)
if(pf(0.54030231_4) /= ACOS(0.54030231_4)) STOP 2
print *, 'PASS'
end program
the error under gfortran 10.0 is:
bbb.f90:3:41:
3 | procedure(real*4), pointer :: pf => ABS
| 1
Error: Symbol ‘abs’ at (1) has no IMPLICIT type
bbb.f90:8:12:
8 | pf => ACOS
| 1
Error: Symbol ‘acos’ at (1) has no IMPLICIT type
If annotate those two if-stmt, the test case will function well.
And the result is:
6.50000000
0.999999940
PASS
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/98948] unexpected error in procedure pointer initialization or assignment with intrinsic
2021-02-03 3:37 [Bug fortran/98948] New: unexpected error in procedure pointer initialization or assignment with intrinsic xiao.liu@compiler-dev.com
@ 2021-02-03 7:00 ` kargl at gcc dot gnu.org
2021-02-03 7:00 ` kargl at gcc dot gnu.org
2021-02-04 0:47 ` sgk at troutmask dot apl.washington.edu
2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-02-03 7:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98948
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
CC| |kargl at gcc dot gnu.org
--- Comment #1 from kargl at gcc dot gnu.org ---
Confirmed, although the original code uses an extension, REAL*4.
This is a better testcase.
program test
implicit none
integer, parameter :: k = kind(1.e0) ! This works.
! integer, parameter :: k = kind(1.d0) ! This gives error. See F2018:C1519
! intrinsic abs, acos ! This is needed, but should not be.
procedure(real(k)), pointer :: pf => ABS
! intrinsic abs, acos ! Or, this is needed, but should not be.
print *, pf(-6.5_k)
if(pf(-6.5_k) /= ABS(-6.5_k)) STOP 1
pf => ACOS
print '(Z8.8)', pf(0.54030231_k)
! Never a good idea to check equality of floating-pointing entities.
if (abs(pf(0.54030231_k) - ACOS(0.54030231_k)) > 1e-7) STOP 2
print *, 'PASS'
end program
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/98948] unexpected error in procedure pointer initialization or assignment with intrinsic
2021-02-03 3:37 [Bug fortran/98948] New: unexpected error in procedure pointer initialization or assignment with intrinsic xiao.liu@compiler-dev.com
2021-02-03 7:00 ` [Bug fortran/98948] " kargl at gcc dot gnu.org
@ 2021-02-03 7:00 ` kargl at gcc dot gnu.org
2021-02-04 0:47 ` sgk at troutmask dot apl.washington.edu
2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-02-03 7:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98948
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-02-03
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/98948] unexpected error in procedure pointer initialization or assignment with intrinsic
2021-02-03 3:37 [Bug fortran/98948] New: unexpected error in procedure pointer initialization or assignment with intrinsic xiao.liu@compiler-dev.com
2021-02-03 7:00 ` [Bug fortran/98948] " kargl at gcc dot gnu.org
2021-02-03 7:00 ` kargl at gcc dot gnu.org
@ 2021-02-04 0:47 ` sgk at troutmask dot apl.washington.edu
2 siblings, 0 replies; 4+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2021-02-04 0:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98948
--- Comment #2 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Feb 03, 2021 at 07:00:10AM +0000, kargl at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98948
>
> kargl at gcc dot gnu.org changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Priority|P3 |P4
> CC| |kargl at gcc dot gnu.org
>
> --- Comment #1 from kargl at gcc dot gnu.org ---
> Confirmed, although the original code uses an extension, REAL*4.
>
> This is a better testcase.
>
Patch tested on original code. Patch has not been regression tested.
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 3b988d1be22..a6ee94216a5 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -299,6 +299,13 @@ gfc_set_default_type (gfc_symbol *sym, int error_flag,
gfc_namespace *ns)
if (ts->type == BT_UNKNOWN)
{
+ /* For 'procedure(real), pointer :: ptr => abs' and 'implicit none'
+ the symbol 'abs' has an unknown type at this point and neither
+ sym->attr.intrinsic nor sym->attr.external are set. So just
+ skip this symbol and hope life is good. */
+ if (sym->attr.function || sym->attr.subroutine)
+ return true;
+
if (error_flag && !sym->attr.untyped)
{
const char *guessed = lookup_symbol_fuzzy (sym->name, sym);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-04 0:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 3:37 [Bug fortran/98948] New: unexpected error in procedure pointer initialization or assignment with intrinsic xiao.liu@compiler-dev.com
2021-02-03 7:00 ` [Bug fortran/98948] " kargl at gcc dot gnu.org
2021-02-03 7:00 ` kargl at gcc dot gnu.org
2021-02-04 0:47 ` sgk at troutmask dot apl.washington.edu
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).