Make the literal argument to pow a double, not an integer
authorChristian Biesinger <cbiesinger@google.com>
Wed, 18 Dec 2019 23:56:17 +0000 (17:56 -0600)
committerChristian Biesinger <cbiesinger@google.com>
Thu, 19 Dec 2019 19:12:30 +0000 (13:12 -0600)
Since pow takes doubles, pass 2.0 instead of 2 to pow ().

Conveniently, this fixes the ambiguous call to pow on Solaris 11
with gcc 5.5 (gcc211 on the compile farm), which has a "using std::pow"
directive in a system header, which brings in float/double/long double
overloads.  Fixes the build on Solaris with enable-targets=all.

gdb/ChangeLog:

2019-12-19  Christian Biesinger  <cbiesinger@google.com>

* score-tdep.c (score7_analyze_prologue): Pass 2.0 instead of
2 to pow ().

Change-Id: Ib18e7e4749ddcbff0727b72a31198f8cb84d1993

gdb/ChangeLog
gdb/score-tdep.c

index 8595b6eafcea98628b6dc3a94fec103e2fb865de..60930a790f97cb3424e0b035535fe12abb4416e9 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-19  Christian Biesinger  <cbiesinger@google.com>
+
+       * score-tdep.c (score7_analyze_prologue): Pass 2.0 instead of
+       2 to pow ().
+
 2019-12-19  Christian Biesinger  <cbiesinger@google.com>
 
        * tui/tui-source.c (tui_source_window::set_contents): Cast argument of
index 5ca763c40f42735bbe402c57c76f7744e09ce2ec..b8abe3d890a09bec8da845b6f74c247f8fa34c9c 100644 (file)
@@ -918,13 +918,15 @@ score7_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
                    && G_FLD (inst->v, 2, 0) == 0x0)
             {
               /* subei! r0, n */
-              sp_offset += (int) pow (2, G_FLD (inst->v, 6, 3));
+              sp_offset += (int) pow (2.0, G_FLD (inst->v, 6, 3));
             }
           else if (G_FLD (inst->v, 14, 7) == 0xc0
                    && G_FLD (inst->v, 2, 0) == 0x0)
             {
               /* addei! r0, n */
-              sp_offset -= (int) pow (2, G_FLD (inst->v, 6, 3));
+             /* Solaris 11+gcc 5.5 has ambiguous overloads of pow, so we
+                pass 2.0 instead of 2 to get the right one.  */
+              sp_offset -= (int) pow (2.0, G_FLD (inst->v, 6, 3));
             }
         }
       else
This page took 0.032846 seconds and 4 git commands to generate.