Forum Jump

Select Group :
Select Forum :
Sorted By :
Sort Order :
From The :
 
Thread Tools  Search this thread 
thomas_boehme
Total Points:
580
Status Points:
80
Brown Belt
July 8, 2009 1:14 AM PDT
Non expected behavior on deferred length string concatenation when they are fields in a type
During testing of the new deferred length character strings, I have found another issue related to string concatenation.

For "normal" deferred charater strings, the following seems to be allowed and is working fine:

A = A // B

However, if the string A is not directly declared as character string, but rather contained in a type (see attached code), then the concatenation does not work as expected.
In the code example, at the end, I'd expect a string 'abcdef', however, I get '===def' on screen.

Is that a issue with the new compiler v11.1 or is a concatenation like that generally not permitted.

regards,
Thomas
PROGRAM STRCAT
  TYPE tA
    CHARACTER(:),ALLOCATABLE :: Text
  END TYPE
  CHARACTER(:), ALLOCATABLE     ::  Str  
  TYPE (tA)      :: A
  A%Text = 'abc'
  Str = 'def'
  A%Text = A%Text // Str
  WRITE(*,*)  A%Text    
END PROGRAM STRCAT

Steve Lionel (Intel)
Total Points:
114,525
Status Points:
114,525
Black Belt
July 8, 2009 8:18 AM PDT
Rate
 
#1
Looks like a bug.  Thanks, I'll report this.  Issue ID is DPD200137715.


Steve Lionel (Intel)
Total Points:
114,525
Status Points:
114,525
Black Belt
August 13, 2009 1:24 PM PDT
Rate
 
|Best Answer
#2 Reply to #1
I expect the fix for this bug to be in the next update (early September).



thomas_boehme
Total Points:
580
Status Points:
80
Brown Belt
September 28, 2009 3:39 AM PDT
Rate
 
#3 Reply to #1
Looks like a bug.  Thanks, I'll report this.  Issue ID is DPD200137715.

I tested it with release 11.1.046 and it seems to be fixed now.

Thanks,
Thomas


thomas_boehme
Total Points:
580
Status Points:
80
Brown Belt
November 11, 2009 2:29 AM PST
Rate
 
#4 Reply to #2

Unfortunately, I need to "reopen" this issue as I believe the fix does not work 100% correctly.

If appending an additional array element, the string length seems to be taken from the added element. In my opinion, the maximum length of all elements should be taken instead. See the code below. In the second WRITE statement the string "This is a long string" is truncated.
Is that intended behavior or accidential? I am pretty sure that it was diffferent with one of the initial IVF11.1 compilers.

Best regards,
Thomas

    program StrArrayConcat
    implicit none
    CHARACTER (LEN=:), ALLOCATABLE, DIMENSION(:) :: Str
    Str = [ 'This is a long string']
    WRITE(*,*) Str(1)
    Str = [ Str, 'Short string' ]
    WRITE(*,*) Str(1)
    WRITE(*,*) Str(2)
    end program StrArrayConcat



Steve Lionel (Intel)
Total Points:
114,525
Status Points:
114,525
Black Belt
November 11, 2009 10:22 AM PST
Rate
 
#5 Reply to #4

I think this is an unrelated issue.  Your program here is not standard-conrforming as it violates the following rule regarding array constructors:

"If type-spec is omitted, each ac-value expression in the array constructor shall have the same length type parameters; in this case, the type and type parameters of the array constructor are those of the ac-value expressions." (p68, lines 8-10)

However, we do have an extension where we use the length of the longest ac-value expression to determine the length of the array constructor, and I'll agree with you that it is not working in this case.   To be standard conforming, you'd want the following instead:

Str = [CHARACTER(LEN(Str)) :: Str, 'Short string' ]

and this works.

I will report this to the developers, but it will have lower priority because your test case is not standard code. The issue number is DPD200141790. This is not a regression - it behaved this way in earlier releases (or failed in a completely different manner in still earlier versions.)






Intel Software Network Forums Statistics

8442 users have contributed to 31547 threads and 100375 posts to date.
In the past 24 hours, we have 10 new thread(s) 34 new posts(s), and 45 new user(s).

In the past 3 days, the most popular thread for everyone has been /fpp interferes with breakpoints/stepping through code - again The most posts were made to Help with hitting maximum record length in the compiler with debug info? The post with the most views is You could save the pre-proce

Please welcome our newest member mrnm