* [patch, fortran] Error for non-contiguous pointers
@ 2017-10-03 18:35 Thomas Koenig
2017-10-07 1:46 ` Jerry DeLisle
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Koenig @ 2017-10-03 18:35 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 630 bytes --]
Hello world,
I have re-thought and simplified the patch for PR49232.
This now uses gfc_is_simply_contiguous, in the
non-strict version. I have also opted for an error
because, well, the use cases rejected by this are really
errors, and will very likely lead to wrong code in
user applications.
Regression-tested. OK for trunk?
Thomas
2017-10-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/49232
* expr.c (gfc_check_pointer_assign): Error
for non-contiguous rhs.
2017-10-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/49232
* gfortran.dg/contiguous_4.f90: New test.
[-- Attachment #2: p7.diff --]
[-- Type: text/x-patch, Size: 686 bytes --]
Index: expr.c
===================================================================
--- expr.c (Revision 253377)
+++ expr.c (Arbeitskopie)
@@ -3851,6 +3851,14 @@
}
}
+ /* Error for assignments of contiguous pointers to targets which is not
+ contiguous. Be lenient in the definition of what counts as
+ congiguous. */
+
+ if (lhs_attr.contiguous && !gfc_is_simply_contiguous (rvalue, false, true))
+ gfc_error ("Assignment to contiguous pointer from non-contiguous "
+ "target at %L", &rvalue->where);
+
/* Warn if it is the LHS pointer may lives longer than the RHS target. */
if (warn_target_lifetime
&& rvalue->expr_type == EXPR_VARIABLE
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch, fortran] Error for non-contiguous pointers
2017-10-03 18:35 [patch, fortran] Error for non-contiguous pointers Thomas Koenig
@ 2017-10-07 1:46 ` Jerry DeLisle
0 siblings, 0 replies; 2+ messages in thread
From: Jerry DeLisle @ 2017-10-07 1:46 UTC (permalink / raw)
To: Thomas Koenig, fortran, gcc-patches
On 10/03/2017 11:35 AM, Thomas Koenig wrote:
> Hello world,
>
> I have re-thought and simplified the patch for PR49232.
> This now uses gfc_is_simply_contiguous, in the
> non-strict version. I have also opted for an error
> because, well, the use cases rejected by this are really
> errors, and will very likely lead to wrong code in
> user applications.
>
> Regression-tested. OK for trunk?
OK
Thanks for patch
>
> Â Â Â Â Thomas
>
> 2017-10-03 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> Â Â Â Â Â Â Â PR fortran/49232
> Â Â Â Â Â Â Â * expr.c (gfc_check_pointer_assign): Error
> Â Â Â Â Â Â Â for non-contiguous rhs.
>
> 2017-10-03 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> Â Â Â Â Â Â Â PR fortran/49232
> Â Â Â Â Â Â Â * gfortran.dg/contiguous_4.f90: New test.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-07 1:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 18:35 [patch, fortran] Error for non-contiguous pointers Thomas Koenig
2017-10-07 1:46 ` Jerry DeLisle
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).