[cfe-commits] [PATCH, RFC] Fix PR14881 (complex integer promotion rules)

Bill Schmidt wschmidt at linux.vnet.ibm.com
Wed Jan 16 13:41:02 PST 2013


This patch addresses PR14881.

Prior to the patch, Clang does not properly promote types when a complex
integer operand is combined with an integer via a binary operator, or when
one is assigned to the other in either order.  This patch detects when
promotion is needed (and permissible) and generates the necessary code.

I've included a rather extensive test case to exercise all the various
cases, including signed and unsigned variants.  I believe that the necessary
handling of signedness is already in place, and the generated code confirms
this to my best understanding.  I hope that the test will run on all targets.
I've assumed that no target has the same size operands for "char" and
"long long," and that no target performs arithmetic on char operands without
extending them to a larger format first.  If there are any targets for which
this is not the case, the test case will need adjustment.  I'd appreciate
any information about the validity of my assumptions before I turn the test
loose on the world...

Thanks in advance for your review!

-- 
Bill Schmidt, Ph.D.
IBM Advance Toolchain for PowerLinux
IBM Linux Technology Center
wschmidt at us.ibm.com
wschmidt at linux.vnet.ibm.com





-------------- next part --------------
A non-text attachment was scrubbed...
Name: complex-convert-2013-01-16.patch
Type: text/x-patch
Size: 64084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130116/67a46fa0/attachment.bin>


More information about the cfe-commits mailing list