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

  • SEARCH
  • Home
  • 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 7926349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:44:37+00:00 2026-06-03T18:44:37+00:00

The following program compiles with ifort (version 12) but not with GFortran (up to

  • 0

The following program compiles with ifort (version 12) but not with GFortran (up to version 4.8):

PROGRAM TEST
IMPLICIT NONE
REAL,DIMENSION(2,2)::X=(/1,2,3,4/)

WRITE(*,*) X

END PROGRAM TEST

GFortran gives the error

REAL,DIMENSION(2,2)::X=(/1,2,3,4/)  
                       1  
Error: Incompatible ranks 2 and 1 in assignment at (1)

Ifort compiles the program and gives the expected output. Is this a bug in GFortran or does intel fortran simply allow non-standard array initialization?

  • 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-03T18:44:39+00:00Added an answer on June 3, 2026 at 6:44 pm

    Re-write array declaration line as:

    REAL,DIMENSION(2,2) :: X = RESHAPE([1,2,3,4],[2,2])
    

    The reason ifort compiled it the other way is non-standard implementation. This is a way you can initialize arrays of rank higher than 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following program compiles with g++ but then crashes upon running: class someClass {
The following program cannot compile in gcc. But it compiles OK with g++ and
I'm using MinGw on Windows 7. The following simple program compiles fine, but the
The following code compiles with gcc-4.5.1 but not in Visual Studio 11. #include <map>
The following C++ program compiles and runs as expected: #include <stdio.h> int main(int argc,
I am not able to compile the following program because of cyclic dependency between
I'm working on a ia64-machine using ICC 11.1. The following program compiles nicely: #include
I have the following program which compiles fine and with no errors or warnings:
I have the following test program. #include <iostream> #include <cstdlib> using namespace std; pthread_mutex_t
I have the following program: ~/test> cat test.cc int main() { int i =

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.