Commit fb7cf01b authored by Robert Bradshaw's avatar Robert Bradshaw

Fix large integer literals used in C double context.

parent db54db2b
...@@ -792,6 +792,8 @@ class IntNode(ConstNode): ...@@ -792,6 +792,8 @@ class IntNode(ConstNode):
def coerce_to(self, dst_type, env): def coerce_to(self, dst_type, env):
if self.type is dst_type: if self.type is dst_type:
return self return self
elif dst_type.is_float:
return FloatNode(self.pos, value=repr(float(self.value)))
node = IntNode(self.pos, value=self.value, node = IntNode(self.pos, value=self.value,
unsigned=self.unsigned, longness=self.longness) unsigned=self.unsigned, longness=self.longness)
if dst_type.is_numeric and not dst_type.is_complex: if dst_type.is_numeric and not dst_type.is_complex:
...@@ -4991,9 +4993,8 @@ class NumBinopNode(BinopNode): ...@@ -4991,9 +4993,8 @@ class NumBinopNode(BinopNode):
return return
if self.type.is_complex: if self.type.is_complex:
self.infix = False self.infix = False
if not self.infix: self.operand1 = self.operand1.coerce_to(self.type, env)
self.operand1 = self.operand1.coerce_to(self.type, env) self.operand2 = self.operand2.coerce_to(self.type, env)
self.operand2 = self.operand2.coerce_to(self.type, env)
def compute_c_result_type(self, type1, type2): def compute_c_result_type(self, type1, type2):
if self.c_types_okay(type1, type2): if self.c_types_okay(type1, type2):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment