diff options
author | Janne Blomqvist <jb@gcc.gnu.org> | 2016-12-20 22:46:13 +0200 |
---|---|---|
committer | Janne Blomqvist <jb@gcc.gnu.org> | 2016-12-20 22:46:13 +0200 |
commit | a388bdc777f582514f8e8bd94274d920d700782f (patch) | |
tree | 1367e04fbdbaddd3e9f1ac2bf0b2e55b92abe8d6 | |
parent | 5b1d0fbaea62946c2b95d2007563a4565e231aa2 (diff) | |
download | gcc-a388bdc777f582514f8e8bd94274d920d700782f.zip gcc-a388bdc777f582514f8e8bd94274d920d700782f.tar.gz gcc-a388bdc777f582514f8e8bd94274d920d700782f.tar.bz2 |
Use the middle-end boolean_type_node
Use the boolean_type_node setup by the middle-end instead of
redefining it. boolean_type_node is not used in GFortran for any
ABI-visible stuff, only internally as the type of boolean
expressions. There appears to be one exception to this, namely the
caf_get* and caf_send* calls which have boolean_type_node
arguments. However, on the library side they seem to use C _Bool, so I
suspect this might be a case of a argument mismatch that hasn't
affected anything so far.
The practical effect of this is that the size of such variables will
be the same as a C _Bool or C++ bool, that is, on most targets a
single byte. Previously we redefined boolean_type_node to be a Fortran
default logical kind sized variable, that is 4 or 8 bytes depending on
compile options. This might enable slightly more compact code, in case
the optimizer determines that the result of such a generated
comparison expression needs to be stored in some temporary location
rather than being used immediately.
Regression tested on x86_64-pc-linux-gnu.
2016-12-20 Janne Blomqvist <jb@gcc.gnu.org>
* trans-types.c (gfc_init_types): Don't redefine boolean type node.
From-SVN: r243830
-rw-r--r-- | gcc/fortran/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/fortran/trans-types.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 06c2f52..5154b19 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2016-12-20 Janne Blomqvist <jb@gcc.gnu.org> + + * trans-types.c (gfc_init_types): Don't redefine boolean type node. + 2016-12-19 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> * trans-decl.c (create_main_function): Remove unused elements to diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 354308f..e8dafa0 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -961,10 +961,6 @@ gfc_init_types (void) wi::mask (n, UNSIGNED, TYPE_PRECISION (size_type_node))); - boolean_type_node = gfc_get_logical_type (gfc_default_logical_kind); - boolean_true_node = build_int_cst (boolean_type_node, 1); - boolean_false_node = build_int_cst (boolean_type_node, 0); - /* ??? Shouldn't this be based on gfc_index_integer_kind or so? */ gfc_charlen_int_kind = 4; gfc_charlen_type_node = gfc_get_int_type (gfc_charlen_int_kind); |