[llvm-commits] CVS: llvm-gcc/gcc/c-typeck.c

Chris Lattner lattner at cs.uiuc.edu
Sat Mar 5 10:50:15 PST 2005



Changes in directory llvm-gcc/gcc:

c-typeck.c updated: 1.7 -> 1.8
---
Log message:

Support hand-written 'offsetof' macros, fixing PR533: http://llvm.cs.uiuc.edu/PR533  and
Regression/CFrontend/2005-03-05-OffsetOfHack.c


---
Diffs of the changes:  (+10 -0)

 c-typeck.c |   10 ++++++++++
 1 files changed, 10 insertions(+)


Index: llvm-gcc/gcc/c-typeck.c
diff -u llvm-gcc/gcc/c-typeck.c:1.7 llvm-gcc/gcc/c-typeck.c:1.8
--- llvm-gcc/gcc/c-typeck.c:1.7	Mon Feb 14 15:24:42 2005
+++ llvm-gcc/gcc/c-typeck.c	Sat Mar  5 12:49:59 2005
@@ -2447,6 +2447,16 @@
 
       argtype = build_pointer_type (argtype);
 
+
+      /* ??? Cope with user tricks that amount to offsetof.  Delete this
+         when we have proper support for integer constant expressions.  */
+      val = get_base_address (arg);
+      if (val && TREE_CODE (val) == INDIRECT_REF
+          && integer_zerop (TREE_OPERAND (val, 0)))
+        return fold_convert (argtype, fold_offsetof (arg));
+
+
+
       if (!c_mark_addressable (arg))
 	return error_mark_node;
 






More information about the llvm-commits mailing list