https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107721

--- Comment #22 from anlauf at gcc dot gnu.org ---
(In reply to Christopher Albert from comment #21)
> Created attachment 62931 [details]
> Next try updated
> 
> Always a pleasure. This one passes the new test cases too. Let's see if we
> can break it in other ways.

Yes, we can... ;-)

  print *,        [ character(16) ::  [ character(2) :: ['abcd','efgh'] ] ]
  print *,        [ character(16) ::  [ character(2) :: ['abcd','efgh'] ] ] //
"|"
  print *, "|" // [ character(16) ::  [ character(2) :: ['abcd','efgh'] ] ]
  print *,        [ character(16) :: ([ character(2) :: ['abcd','efgh'] ])]
  print *,        [ character(16) :: ([ character(2) :: ['abcd','efgh'] ])] //
"|"
  print *, "|" // [ character(16) :: ([ character(2) :: ['abcd','efgh'] ])]
end

This prints with the above patch applied:

 ab              ef              
 abcd            |efgh            |
 |abcd            |efgh            
 ab              ef              
 abcd            |efgh            |
 |abcd            |efgh            

The 1st and 4th line are correct, the others lack the intermediate truncation
to character(2).  Possibly a missing simplification after setting the
character length.

NAG produces the correct result:

 ab              ef              
 ab              |ef              |
 |ab              |ef              
 ab              ef              
 ab              |ef              |
 |ab              |ef              

Interestingly, ifx fails here badly, even more than nvfortran...

But as Jerry said, you are likely very very close.

If you succeed in fixing this gem, I'd suggest to post the next patch to
the ML.

Reply via email to