Preconnected and internal units currently have their sign mode set to 
SIGN_SUPPRESS, rather than the logical value of SIGN_UNSPECIFIED. This does not 
matter in most cases, since our chosen processor-dependent behavior is to 
suppress optional plus signs anyway…

… except when one tries to override the default behavior with environment 
variable GFORTRAN_OPTIONAL_PLUS, which is thus currently broken on internal and 
preconnected units. Take the following code:

  character(len=20) :: s
  print *, 42.
  write(s,"(G0)") 42.
  print *, s
  end

without the patch, run with “GFORTRAN_OPTIONAL_PLUS=y”, it will still output:

   42.0000000    
 42.0000000          

while with the patch, it will now correctly output (with 
GFORTRAN_OPTIONAL_PLUS=y):

  +42.0000000    
 +42.0000000         


I regtested on x86_64-apple-darwin15, and committed as trivial.
(I couldn’t come up with a way to figure out how to test that in the testuite, 
though.)

FX



Attachment: sign.ChangeLog
Description: Binary data

Attachment: sign.diff
Description: Binary data

Reply via email to