Bug 36076 - Pointer intent(IN): Mark as const pointer
Summary: Pointer intent(IN): Mark as const pointer
Status: RESOLVED DUPLICATE of bug 23169
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2008-04-29 06:09 UTC by Tobias Burnus
Modified: 2008-12-27 00:38 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2008-04-29 06:09:12 UTC
Unless I'm mistaken, we never mark dummy pointers as "const" for the middle end.
For

  subroutine sub(a)
    integer, pointer, intent(in) :: a

the C code would be "void sub(const int *a)". I think we miss the "const" in the when creating the GIMPLE. In principle this "const" should also be applied to other arguments which are have not the POINTER argument. (However, we need to be careful as the front end might generate pointer assignments itself.)
Comment 1 Andrew Pinski 2008-04-29 11:35:06 UTC
const for non function decls, mean nothing to the middle-end.
Comment 2 Andrew Pinski 2008-04-29 11:35:26 UTC
I mean on local variables, const mean nothing.
Comment 3 Tobias Burnus 2008-04-29 12:03:45 UTC
> const for non function decls, mean nothing to the middle-end.
> I mean on local variables, const mean nothing.

Good to know. Then every (non-VALUE) dummy argument except POINTERs and ALLOCATABLEs can be marked as "const" -- and POINTERS and ALLOCATABLE if they are INTENT(IN).
Comment 4 Daniel Franke 2008-12-27 00:38:35 UTC

*** This bug has been marked as a duplicate of 23169 ***