summaryrefslogtreecommitdiff
path: root/ortho/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'ortho/gcc')
-rw-r--r--ortho/gcc/ortho-lang.c4
-rw-r--r--ortho/gcc/ortho_gcc.ads7
2 files changed, 7 insertions, 4 deletions
diff --git a/ortho/gcc/ortho-lang.c b/ortho/gcc/ortho-lang.c
index 5404afb..fe02dbc 100644
--- a/ortho/gcc/ortho-lang.c
+++ b/ortho/gcc/ortho-lang.c
@@ -1442,13 +1442,15 @@ new_access_element (tree acc)
}
tree
-new_offsetof (tree field, tree rtype)
+new_offsetof (tree rec_type, tree field, tree rtype)
{
tree off;
tree bit_off;
HOST_WIDE_INT pos;
tree res;
+ gcc_assert (DECL_CONTEXT (field) == rec_type);
+
off = DECL_FIELD_OFFSET (field);
/* The offset must be a constant. */
diff --git a/ortho/gcc/ortho_gcc.ads b/ortho/gcc/ortho_gcc.ads
index 31005ae..d01caee 100644
--- a/ortho/gcc/ortho_gcc.ads
+++ b/ortho/gcc/ortho_gcc.ads
@@ -237,9 +237,10 @@ package Ortho_Gcc is
-- unsgined type RTYPE.
function New_Alignof (Atype : O_Tnode; Rtype : O_Tnode) return O_Cnode;
- -- Returns the offset of FIELD in its record. The result is a literal
- -- of unsigned type RTYPE.
- function New_Offsetof (Field : O_Fnode; Rtype : O_Tnode) return O_Cnode;
+ -- Returns the offset of FIELD in its record REC_TYPE. The result is a
+ -- literal of unsigned type or access type RTYPE.
+ function New_Offsetof (Rec_Type : O_Tnode; Field : O_Fnode; Rtype : O_Tnode)
+ return O_Cnode;
-- Get an element of an array.
-- INDEX must be of the type of the array index.