Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8962525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:08:45+00:00 2026-06-15T16:08:45+00:00

UPDATE: My modified code looks like this: program run_module_test use module_test implicit none TYPE(newXYZ),

  • 0

UPDATE: My modified code looks like this:

program run_module_test
    use module_test
    implicit none   

    TYPE(newXYZ), allocatable, intent(inout) :: xyzArray(:)

    call update(xyzArray)
    write(6,*)'xyzArray',xyzArray

end program run_module_test

module module_test
    implicit none

    TYPE :: newXYZ
        real(4) :: x, u
        real(4) :: y, v
        real(4) :: z, w
        real(4),dimension(3) :: uvw     
    END TYPE

    integer(4) :: shape = 3

contains

    subroutine update(xyzArray)

    integer(4) :: i
    TYPE(newXYZ), allocatable, intent(inout) :: xyzArray(:)
    allocate( xyzArray(shape) ) 

    do i = 1, shape
        xyzArray(i)%x = 0
        xyzArray(i)%y = 0
        xyzArray(i)%z = 0
        xyzArray(i)%u = 0
        xyzArray(i)%v = 0
        xyzArray(i)%w = 0
        xyzArray(i)%uvw = (/0,0,0/)
    end do
    return
    end subroutine update

end module module_test

When they are compiled, they generate a similar error:

 TYPE(newXYZ), allocatable, intent(inout) :: xyzArray(:)
                                                    1
Error: ALLOCATABLE attribute conflicts with DUMMY attribute at (1)

When I eliminate the argument in update() subroutine, I receive a contradictory error:

TYPE(newXYZ), allocatable, intent(inout) :: xyzArray(:)
                                                       1
Error: Symbol at (1) is not a DUMMY variable

Have I eliminated the sources of error pointed out in the helpful suggestions? Could this be a compiler related error (using mpi90)?

~~~First Edit~~~
I have a subroutine whose input argument is an array of user defined type XYZ. I wish to deallocate xyzArray and allocate/modify it to a different size in the body of the subroutine. I attempted the method suggested by changing array dimensions in fortran, but when I do the following:

subroutine update(xyzArray, ...)
...
TYPE (XYZ), allocatable :: xyzArray(:)

I receive an error message:

Error: ALLOCATABLE attribute conflicts with DUMMY attribute at (1)

When I try:

subroutine update(xyzArray, ...)
...
deallocate( xyzArray(myshape) )
allocate( xyzArray(newshape) )

I receive error messages:

Error: Expression in DEALLOCATE statement at (1) must be ALLOCATABLE or a POINTER
Error: Expression in ALLOCATE statement at (1) must be ALLOCATABLE or a POINTER

What do I need to do to change the size of the array in the subroutine?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:08:46+00:00Added an answer on June 15, 2026 at 4:08 pm

    To do this:

    • The dummy argument must be allocatable. Allocatable dummy arguments require a compiler that implements the relevant part of the Fortran 2003 standard (or a Fortran 95 compiler that implements the so called “allocatable” TR).

    • An explicit interface to the procedure is required (the procedure must be a module procedure, an internal procedure or have an interface block in the calling scope).

    • The dummy argument must not be intent(in). If you are not using the allocation status or other aspects of the value of the dummy argument at all in the subroutine then intent(out) may be appropriate (if allocated beforehand the dummy argument will be automatically deallocated when the procedure is called), otherwise intent(inout) or no intent.

    (Your second block of example code has a syntax error with the deallocate statement – you should simply specify the xyzArray variable, leave off the (myshape) shape specification))

    For example, in a module:

    subroutine update(xyzArray)
      type(xyz), allocatable, intent(inout) :: xyzArray(:)
      ...
      if (allocated(xyzArray)) deallocate(xyzArray)
      allocate(xyzArray(newshape))
      ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code Currently my code looks like that. $stmt = $this->db->prepare(SELECT m.id, m.from_id, m.to_id, m.subject,
UPDATE: Based on suggestions here, I've modified my code. To get a handle on
UPDATE: I've been playing around with this more, and it seems like tmux's clear-history
UPDATE: I've modified the code to drop the indexes before the inserting, but it
My file looks like this: <MAIN> <SUB_MAIN>one</SUB_MAIN> <VER>version#</VER> (OTHER STUFF...) <LOCATION>PATH</LOCATION> </MAIN> <MAIN> <SUB_MAIN>two</SUB_MAIN>
My matrix looks like this. ['Hotel', ' excellent', ' very good', ' average', '
I try to use jqplot for drawing an graph. So i modified this example
I want to load a CSV file that looks like this: Acct. No.,1-15 Days,16-30
Let's say that I have a object that looks like this var object =
Update: I reported this as a bug to Apple and they fixed it! All

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.