Patch RFA: [C family frontend]: avoid weird constant values in libgo/sysinfo.go

Message ID CAOyqgcXVR44KamVoYm7W2g4-Y7ibD1MPOiLvhe=r-es1Ay=NXA@mail.gmail.com
State New
Headers show
Series
  • Patch RFA: [C family frontend]: avoid weird constant values in libgo/sysinfo.go
Related show

Commit Message

Ian Lance Taylor Aug. 20, 2019, 11:36 p.m.
On Mon, Aug 12, 2019 at 8:21 PM Xiangdong JI <xiangdong.ji@arm.com> wrote:
>

> The .go files generated during building gccgo seem to have a few constants with weird values, for example:

>

> // sysinfo.go (on x86-64, latest gcc-9 trunk)

>

> const ___FLT128_MAX__ = 1.1

> const ___FLT32X_DENORM_MIN__ = 1.1

>

> as a comparison, gollvm generates expected values.

> Could it be caused by incorrect building setting?


Per later discussion, this problem is fixed by this patch.
Bootstrapped and ran full testsuite on x86_64-pc-linux-gnu.

OK for mainline?

Ian


2019-08-20  Ian Lance Taylor  <iant@golang.org>

* c-cppbuiltin.c (builtin_define_with_hex_fp_value): Always expand
when using -fgo-dump-spec.

Comments

Ian Lance Taylor Sept. 3, 2019, 2:30 p.m. | #1
On Tue, Aug 20, 2019 at 4:36 PM Ian Lance Taylor <iant@golang.org> wrote:
>

> On Mon, Aug 12, 2019 at 8:21 PM Xiangdong JI <xiangdong.ji@arm.com> wrote:

> >

> > The .go files generated during building gccgo seem to have a few constants with weird values, for example:

> >

> > // sysinfo.go (on x86-64, latest gcc-9 trunk)

> >

> > const ___FLT128_MAX__ = 1.1

> > const ___FLT32X_DENORM_MIN__ = 1.1

> >

> > as a comparison, gollvm generates expected values.

> > Could it be caused by incorrect building setting?

>

> Per later discussion, this problem is fixed by this patch.

> Bootstrapped and ran full testsuite on x86_64-pc-linux-gnu.

>

> OK for mainline?

>

> Ian

>

>

> 2019-08-20  Ian Lance Taylor  <iant@golang.org>

>

> * c-cppbuiltin.c (builtin_define_with_hex_fp_value): Always expand

> when using -fgo-dump-spec.


Ping Joseph Myers as C frontend maintainer.

Ian
Index: c-family/c-cppbuiltin.c
===================================================================
--- c-family/c-cppbuiltin.c	(revision 274749)
+++ c-family/c-cppbuiltin.c	(working copy)
@@ -1643,6 +1643,7 @@ builtin_define_with_hex_fp_value (const
   /* This is very expensive, so if possible expand them lazily.  */
   if (lazy_hex_fp_value_count < LAZY_HEX_FP_VALUES_CNT
       && flag_dump_macros == 0
+      && flag_dump_go_spec == NULL
       && !cpp_get_options (parse_in)->traditional)
     {
       if (lazy_hex_fp_value_count == 0)
Joseph Myers Sept. 3, 2019, 7:35 p.m. | #2
On Tue, 3 Sep 2019, Ian Lance Taylor wrote:

> > * c-cppbuiltin.c (builtin_define_with_hex_fp_value): Always expand

> > when using -fgo-dump-spec.

> 

> Ping Joseph Myers as C frontend maintainer.


This patch is OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

Patch

Index: c-family/c-cppbuiltin.c
===================================================================
--- c-family/c-cppbuiltin.c	(revision 274749)
+++ c-family/c-cppbuiltin.c	(working copy)
@@ -1643,6 +1643,7 @@  builtin_define_with_hex_fp_value (const
   /* This is very expensive, so if possible expand them lazily.  */
   if (lazy_hex_fp_value_count < LAZY_HEX_FP_VALUES_CNT
       && flag_dump_macros == 0
+      && flag_dump_go_spec == NULL
       && !cpp_get_options (parse_in)->traditional)
     {
       if (lazy_hex_fp_value_count == 0)