[Flang-dev] overflow on integer output

Mehmet Erol Sanliturk m.e.sanliturk at gmail.com
Wed Aug 22 20:03:27 EDT 2018

On Thu, Aug 23, 2018 at 2:36 AM, blubee blubeeme <gurenchan at gmail.com>

> I get some strange output after compiling Fortran code and running it.
> Example, here's a sample program; snakes and ladders.
> Source code: https://pastebin.com/ckS6tmfW
> Here's the output: https://pastebin.com/eqeTx0Xu
> This program calculates the area of a cylinder: https://pastebin.
> com/qRPkUaVa
> here's the output again:
> Enter radius and height.
> 21
> 100
> radius= 21.00     height=100.00     area=******
> Perform another calculation? y[n]
> quite a few test programs gives ***** for number values, do you know why?
> it could be something wrong with the source code that I am compiling, a
> problem in the way I edited the flang source and introduced a bug or I need
> to pass some compiler flags to get the output code to display properly or
> maybe something that I haven't thought about yet.
> Do you have any idea why?
> Best,
> Owen

First thing to come to mind is the following :

The value to be printed is larger than the area defined by your FORMAT
specifier for it .

For example , your value is   345.75 , your FORMAT specifier for it is F5.3
means  value will be printed in the form   xx.xxx .
Then you will see   ***** in that area because   345. is greater than 99 (
more than two digits ) ...
Increase your FORMAT specifier for the value , for example  F7.2 :  345.75
will be printed correctly .

Mehmet Erol Sanliturk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/attachments/20180823/3a2ddf5a/attachment.html>

More information about the flang-dev mailing list