diff mbox

[v3] Library bits of c++/49813

Message ID 4E312F5D.2050304@oracle.com
State New
Headers show

Commit Message

Paolo Carlini July 28, 2011, 9:43 a.m. UTC
Hi Andreas,
> /usr/local/gcc/gcc-20110728/Build/ia64-suse-linux/libstdc++-v3/include/cmath: 
> In function 'constexpr float std::fma(float, float, float)': 
> /usr/local/gcc/gcc-20110728/Build/ia64-suse-linux/libstdc++-v3/include/cmath:1288:43: 
> sorry, unimplemented: unexpected ast of kind fma_expr 
> /usr/local/gcc/gcc-20110728/Build/ia64-suse-linux/libstdc++-v3/include/cmath:1288:43: 
> internal compiler error: in potential_constant_expression_1, at 
> cp/semantics.c:8094
in the past we encountered already a few small problems of this kind, 
with cases missing from the potential_constant_expression_1 switch. I 
believe something quite close to what I'm attaching below should be 
enough, can you give it a try?

In any case, we definitely want Jason to have a look as soon as 
possible. If you want to restore the ia64 bootstrap in the meanwhile, 
feel free to comment out any troublesome constexpr specifier in that 
file (or replacing it with inline).

Thanks!
Paolo.

//////////////////////

Comments

Steve Ellcey July 28, 2011, 8:26 p.m. UTC | #1
Paolo,

I ran into this problem on the IA64 HP-UX bootstrap and tried your
patch to semantics.c.  It fixed the problem for me and I was able
to bootstrap.

Steve Ellcey
sje@cup.hp.com
Pat Haugen July 28, 2011, 8:29 p.m. UTC | #2
On 07/28/2011 04:43 AM, Paolo Carlini wrote:
>> /usr/local/gcc/gcc-20110728/Build/ia64-suse-linux/libstdc++-v3/include/cmath:
>> In function 'constexpr float std::fma(float, float, float)':
>> /usr/local/gcc/gcc-20110728/Build/ia64-suse-linux/libstdc++-v3/include/cmath:1288:43:
>> sorry, unimplemented: unexpected ast of kind fma_expr
>> /usr/local/gcc/gcc-20110728/Build/ia64-suse-linux/libstdc++-v3/include/cmath:1288:43:
>> internal compiler error: in potential_constant_expression_1, at
>> cp/semantics.c:8094
> in the past we encountered already a few small problems of this kind, with cases
> missing from the potential_constant_expression_1 switch. I believe something
> quite close to what I'm attaching below should be enough, can you give it a try?
>
> In any case, we definitely want Jason to have a look as soon as possible. If you
> want to restore the ia64 bootstrap in the meanwhile, feel free to comment out
> any troublesome constexpr specifier in that file (or replacing it with inline).
>
> Thanks!
> Paolo.
>
> //////////////////////
>
>
>
> p
>
>
> Index: semantics.c
> ===================================================================
> --- semantics.c	(revision 176846)
> +++ semantics.c	(working copy)
> @@ -8057,6 +8057,13 @@ potential_constant_expression_1 (tree t, bool want
>   	  return false;
>         return true;
>
> +    case FMA_EXPR:
> +      for (i = 0; i<  3; ++i)
> +	if (!potential_constant_expression_1 (TREE_OPERAND (t, i),
> +					      true, flags))
> +	  return false;
> +      return true;
> +
>       case COND_EXPR:
>       case VEC_COND_EXPR:
>         /* If the condition is a known constant, we know which of the legs we

I am seeing the same error on PowerPC and the above patch fixes it.

-Pat
Paolo Carlini July 28, 2011, 8:46 p.m. UTC | #3
Hi,

> I ran into this problem on the IA64 HP-UX bootstrap and tried your
> patch to semantics.c.  It fixed the problem for me and I was able
> to bootstrap.

Thanks Steve. I say let's commit it, I'm pretty sure it's by and large correct and anyway it unbreaks the bootstrap for many people. Can you take care of that? I'm traveling and can only do it in a few hours.

Thanks,
Paolo
Steve Ellcey July 28, 2011, 9 p.m. UTC | #4
On Thu, 2011-07-28 at 22:46 +0200, Paolo Carlini wrote:
> Hi,
> 
> > I ran into this problem on the IA64 HP-UX bootstrap and tried your
> > patch to semantics.c.  It fixed the problem for me and I was able
> > to bootstrap.
> 
> Thanks Steve. I say let's commit it, I'm pretty sure it's by and large correct and anyway it
> unbreaks the bootstrap for many people. Can you take care of that? I'm traveling and can only
> do it in a few hours.
> 
> Thanks,
> Paolo

OK, I went ahead and checked it in.  Here is the ChangeLog I put in:



2011-07-28  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/49813
        * semantics.c (potential_constant_expression_1):  Handle FMA_EXPR.

Steve Ellcey
sje@cup.hp.com
diff mbox

Patch

Index: semantics.c
===================================================================
--- semantics.c	(revision 176846)
+++ semantics.c	(working copy)
@@ -8057,6 +8057,13 @@  potential_constant_expression_1 (tree t, bool want
 	  return false;
       return true;
 
+    case FMA_EXPR:
+      for (i = 0; i < 3; ++i)
+	if (!potential_constant_expression_1 (TREE_OPERAND (t, i),
+					      true, flags))
+	  return false;
+      return true;
+
     case COND_EXPR:
     case VEC_COND_EXPR:
       /* If the condition is a known constant, we know which of the legs we