public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47605] New: Document that C_Bool might be the wrong constant for C Booleans
@ 2011-02-04  7:17 burnus at gcc dot gnu.org
  2014-03-22 19:34 ` [Bug fortran/47605] " dominiq at lps dot ens.fr
  2015-08-31  5:31 ` dominiq at lps dot ens.fr
  0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-02-04  7:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47605

           Summary: Document that C_Bool might be the wrong constant for C
                    Booleans
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: documentation
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


James pointed out the following at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/3c2784c55d402ced

c_bool is typically one byte wide, and c_int 4. That means: Most C programs -
except of those few which explicitly use _Bool, use a 4 byte and not a 1 byte
Boolean variables.

I think one should put a warning into the manual - either in the C Binding part
[1] or in the section about the ISO C Binding constants [2], or in both.

[1] http://gcc.gnu.org/onlinedocs/gfortran/Intrinsic-Types.html
[2]http://gcc.gnu.org/onlinedocs/gfortran/ISO_005fC_005fBINDING.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/47605] Document that C_Bool might be the wrong constant for C Booleans
  2011-02-04  7:17 [Bug fortran/47605] New: Document that C_Bool might be the wrong constant for C Booleans burnus at gcc dot gnu.org
@ 2014-03-22 19:34 ` dominiq at lps dot ens.fr
  2015-08-31  5:31 ` dominiq at lps dot ens.fr
  1 sibling, 0 replies; 3+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-03-22 19:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47605

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-03-22
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
In [1] I see

> For logical types, please note that the Fortran standard only guarantees
> interoperability between C99's _Bool and Fortran's C_Bool-kind logicals and C99
> defines that true has the value 1 and false the value 0. Using any other integer
> value with GNU Fortran's LOGICAL (with any kind parameter) gives an undefined
> result. (Passing other integer values than 0 and 1 to GCC's _Bool is also
> undefined, unless the integer is explicitly or implicitly casted to _Bool.)

What should be added to that?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/47605] Document that C_Bool might be the wrong constant for C Booleans
  2011-02-04  7:17 [Bug fortran/47605] New: Document that C_Bool might be the wrong constant for C Booleans burnus at gcc dot gnu.org
  2014-03-22 19:34 ` [Bug fortran/47605] " dominiq at lps dot ens.fr
@ 2015-08-31  5:31 ` dominiq at lps dot ens.fr
  1 sibling, 0 replies; 3+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-08-31  5:31 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> > For logical types, please note that the Fortran standard only guarantees
> > interoperability between C99's _Bool and Fortran's C_Bool-kind logicals and C99
> > defines that true has the value 1 and false the value 0. Using any other integer
> > value with GNU Fortran's LOGICAL (with any kind parameter) gives an undefined
> > result. (Passing other integer values than 0 and 1 to GCC's _Bool is also
> > undefined, unless the integer is explicitly or implicitly casted to _Bool.)
>
> What should be added to that?

No answer for over a year. Closing as FIXED.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-31  5:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-04  7:17 [Bug fortran/47605] New: Document that C_Bool might be the wrong constant for C Booleans burnus at gcc dot gnu.org
2014-03-22 19:34 ` [Bug fortran/47605] " dominiq at lps dot ens.fr
2015-08-31  5:31 ` dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).