# Is the behavior of -standard-semantics expected?

**URL:** <https://fortran-lang.discourse.group/t/is-the-behavior-of-standard-semantics-expected/8338>\
**Category:** Intel\
**Created:** [July 12, 2024, 2:48pm UTC](https://fortran-lang.discourse.group/t/is-the-behavior-of-standard-semantics-expected/8338 "2024-07-12T14:48:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ali](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ali/32/751_2.png) [@Ali](https://fortran-lang.discourse.group/u/Ali)\
**Post date:** [July 12, 2024, 2:48pm UTC](https://fortran-lang.discourse.group/t/is-the-behavior-of-standard-semantics-expected/8338/1 "2024-07-12T14:48:53Z")

</div>

I encountered some unexpected behavior with `ifx 2024.2.0 20240602` when using the `-standard-semantics` flag. Here’s a minimal example to illustrate:

```auto
program test
    implicit none
    real a
    a = 0.012345678
    print*, a
    print'(f11.9)', a
    print'(g0)', a
end program

```

When I compile and run the program with the flag, I get the following output:

`ifx -standard-semantics test.f90 && ./a.out`

```auto
 1.2345678E-02
0.012345678
.1E-01 not expected!

```

However, without the flag, the output is what I expected:

`ifx test.f90 && ./a.out`

```auto
  1.2345678E-02
0.012345678
.1234568E-01 (7?)

```

As this flag is used by `fpm`, it took some time to identify the problem. Is this behavior expected when using this flag?

---

<div class="post-metadata">

**Author:** ![btrettel](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@btrettel](https://fortran-lang.discourse.group/u/btrettel)\
**Post date:** [July 12, 2024, 6:03pm UTC](https://fortran-lang.discourse.group/t/is-the-behavior-of-standard-semantics-expected/8338/2 "2024-07-12T18:03:54Z")

</div>

I recall reading about this before. Here’s some more information from the Intel forum:

> **[\-standard-semantics switch causes the g0 descriptor to generate incorrect output](https://community.intel.com/t5/Intel-Fortran-Compiler/standard-semantics-switch-causes-the-g0-descriptor-to-generate/td-p/1476749)**
>
> When -standard-semantics is used on ifort or ifx the g0 format generates output I consider to be incorrect. program main implicit none doubleprecision :: value character(len=80) :: string value=-1234.0d-20 write(string,'(g0)')value...

---

<div class="post-metadata">

**Author:** ![sblionel](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/sblionel/32/853_2.png) [@sblionel](https://fortran-lang.discourse.group/u/sblionel)\
**Post date:** [July 12, 2024, 6:28pm UTC](https://fortran-lang.discourse.group/t/is-the-behavior-of-standard-semantics-expected/8338/3 "2024-07-12T18:28:09Z")

</div>

I remember that and responded with my analysis at the time. I’ve asked one of my Intel contacts to take a look at it.

---

<div class="post-metadata">

**Author:** ![greenrongreen](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/greenrongreen/32/1249_2.png) [@greenrongreen](https://fortran-lang.discourse.group/u/greenrongreen)\
**Post date:** [July 12, 2024, 8:11pm UTC](https://fortran-lang.discourse.group/t/is-the-behavior-of-standard-semantics-expected/8338/4 "2024-07-12T20:11:05Z")

</div>

We haven’t gotten to this issue to date. The bug ID is CMPLRLIBS-34487. I am following up with our Runtime Libraries team. For now, you can use option -assume old\_e0g0\_format (linux) or /assume:old\_e0g0\_format

---

<div class="post-metadata">

**Author:** ![urbanjost](https://avatars.discourse-cdn.com/v4/letter/u/0ea827/32.png) [@urbanjost](https://fortran-lang.discourse.group/u/urbanjost)\
**Post date:** [July 12, 2024, 9:07pm UTC](https://fortran-lang.discourse.group/t/is-the-behavior-of-standard-semantics-expected/8338/5 "2024-07-12T21:07:13Z")

</div>

[Use -standard-semanics by default with Intel compilers · Issue #868 · fortran-lang/fpm · GitHub](https://github.com/fortran-lang/fpm/issues/868) was the main thread in fpm(1). Some of the other discussion there shows this issue and the performance issues were not ever completely addressed. So would a recommendation be that instead of -standard-semantics that a series of -assume options should be used instead; or that fpm(1) should be changed to include -assume old\_e0g0\_format if -standard-semantics is still included? That is, if fpm(1) tries to encourage standard-conformant coding in general, is the current set of compiler defaults appropriate?

As I see it, a quick PR should add -assume old\_e0g0\_format (?)
