[Bug fortran/84924] Erroneous error in C_F_POINTER

2018-03-25 Thread johnsonsr at ornl dot gov
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84924

--- Comment #9 from Seth Johnson  ---
Thanks guys for the fast fix and review!

[Bug fortran/84924] Erroneous error in C_F_POINTER

2018-03-25 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84924

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Dominique d'Humieres  ---
Closing as FIXED.

[Bug fortran/84924] Erroneous error in C_F_POINTER

2018-03-25 Thread dominiq at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84924

--- Comment #7 from dominiq at gcc dot gnu.org ---
Author: dominiq
Date: Sun Mar 25 11:30:24 2018
New Revision: 258843

URL: https://gcc.gnu.org/viewcvs?rev=258843=gcc=rev
Log:
2018-03-25  Seth Johnson 
Dominique d'Humieres  

PR fortran/84924
* check.c (gfc_check_c_f_pointer): Allow scalar noninteroperable
scalar derived type with -std=f2003 and -std=f2008.

2018-03-25  Seth Johnson 
Dominique d'Humieres  

PR fortran/84924
* gfortran.dg/scalar_pointer_1.f90: New test.


Added:
trunk/gcc/testsuite/gfortran.dg/scalar_pointer_1.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/check.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/84924] Erroneous error in C_F_POINTER

2018-03-23 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84924

Dominique d'Humieres  changed:

   What|Removed |Added

   Priority|P3  |P4

[Bug fortran/84924] Erroneous error in C_F_POINTER

2018-03-23 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84924

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|WAITING |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |dominiq at lps dot 
ens.fr

--- Comment #6 from Dominique d'Humieres  ---
> That looks perfect, thank you for looking into this.

So taking the PR. I'll do the packaging and submit it.

[Bug fortran/84924] Erroneous error in C_F_POINTER

2018-03-23 Thread johnsonsr at ornl dot gov
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84924

--- Comment #5 from Seth Johnson  ---
That looks perfect, thank you for looking into this.

(In reply to Dominique d'Humieres from comment #4)
> Is the following patch OK?
> 
>return false;
>  }
>  
> -  if (!is_c_interoperable (fptr, , false, true))
> +  if (fptr->rank > 0 && !is_c_interoperable (fptr, , false, true))
>  return gfc_notify_std (GFC_STD_F2008_TS, "Noninteroperable array FPTR "
>  "at %L to C_F_POINTER: %s", >where, msg);

[Bug fortran/84924] Erroneous error in C_F_POINTER

2018-03-23 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84924

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2018-03-23
 Ever confirmed|0   |1

--- Comment #4 from Dominique d'Humieres  ---
Is the following patch OK?

   return false;
 }

-  if (!is_c_interoperable (fptr, , false, true))
+  if (fptr->rank > 0 && !is_c_interoperable (fptr, , false, true))
 return gfc_notify_std (GFC_STD_F2008_TS, "Noninteroperable array FPTR "
   "at %L to C_F_POINTER: %s", >where, msg);

[Bug fortran/84924] Erroneous error in C_F_POINTER

2018-03-17 Thread johnsonsr at ornl dot gov
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84924

--- Comment #3 from Seth Johnson  ---
That's correct, because those standards include TS 29113 which allows arrays to
be referenced. `-std=f2008ts` also works. The problem is that the usage
described is valid Fortran 2003 but is marked otherwise.

This is like the "const" qualifier raising an error with `gcc -std=c89` but
allowing it with `gcc -std=c99`. It's valid with C99, sure, but the feature is
allowed in the C89 standard as well.

[Bug fortran/84924] Erroneous error in C_F_POINTER

2018-03-17 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84924

--- Comment #2 from Harald Anlauf  ---
There is no error for -std=f2008ts or -std=2018.

[Bug fortran/84924] Erroneous error in C_F_POINTER

2018-03-17 Thread johnsonsr at ornl dot gov
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84924

--- Comment #1 from Seth Johnson  ---
- Correction in test case: `call dellocate(` should be replaced by
`deallocate(` (but this doesn't affect the behavior or test outcome
- Also note that the Fortran 2003 standard itself includes a structurally
identical example in "C.10.2.4 Example of opaque communication between C and
Fortran", if further evidence is needed that this is allowable with
`-std=f2003` and `-std=f2008`.