summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-19 13:57:02 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-19 13:57:02 +0000
commit86329e108519fe3937c713254c953e7b50b7e5f7 (patch)
treed3af0462240926fde0bc1fa0e927c003f9a99fe0
parentb31544c16a48f719fe9b2855916ba2a9cf3cd483 (diff)
downloadgcc-86329e108519fe3937c713254c953e7b50b7e5f7.tar.gz
2011-05-19 Basile Starynkevitch <basile@starynkevitch.net>
* melt-runtime.c (check_pointer_at): Use MELTOBMAG__FIRST. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@173911 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.MELT4
-rw-r--r--gcc/melt-runtime.c52
2 files changed, 11 insertions, 45 deletions
diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index 292254e68ef..f3610dd4cf4 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,6 +1,10 @@
2011-05-19 Basile Starynkevitch <basile@starynkevitch.net>
+ * melt-runtime.c (check_pointer_at): Use MELTOBMAG__FIRST.
+
+2011-05-19 Basile Starynkevitch <basile@starynkevitch.net>
+
{{Regenerated all}}
* melt/generated/gt-melt-runtime-plugin.h: Regenerate.
* melt/generated/meltrunsup-inc.c: Regenerate.
diff --git a/gcc/melt-runtime.c b/gcc/melt-runtime.c
index 194bd87c761..97095fafb4d 100644
--- a/gcc/melt-runtime.c
+++ b/gcc/melt-runtime.c
@@ -723,6 +723,7 @@ static inline void
check_pointer_at (const char msg[], long count, melt_ptr_t * pptr,
const char *filenam, int lineno)
{
+ unsigned magic = 0;
melt_ptr_t ptr = *pptr;
if (!ptr)
return;
@@ -730,51 +731,12 @@ check_pointer_at (const char msg[], long count, melt_ptr_t * pptr,
melt_fatal_error
("<%s#%ld> corrupted pointer %p (at %p) without discr at %s:%d", msg,
count, (void *) ptr, (void *) pptr, lbasename (filenam), lineno);
- switch (ptr->u_discr->meltobj_magic)
- {
- case MELTOBMAG_OBJECT:
- case MELTOBMAG_DECAY:
- case MELTOBMAG_BOX:
- case MELTOBMAG_MULTIPLE:
- case MELTOBMAG_CLOSURE:
- case MELTOBMAG_ROUTINE:
- case MELTOBMAG_LIST:
- case MELTOBMAG_PAIR:
- case MELTOBMAG_INT:
- case MELTOBMAG_MIXINT:
- case MELTOBMAG_MIXLOC:
- case MELTOBMAG_MIXBIGINT:
- case MELTOBMAG_REAL:
- case MELTOBMAG_STRING:
- case MELTOBMAG_STRBUF:
- case MELTOBMAG_TREE:
- case MELTOBMAG_GIMPLE:
- case MELTOBMAG_GIMPLESEQ:
- case MELTOBMAG_BASICBLOCK:
- case MELTOBMAG_EDGE:
- case MELTOBMAG_LOOP:
- case MELTOBMAG_RTX:
- case MELTOBMAG_RTVEC:
- case MELTOBMAG_BITMAP:
- case MELTOBMAG_MAPOBJECTS:
- case MELTOBMAG_MAPTREES:
- case MELTOBMAG_MAPGIMPLES:
- case MELTOBMAG_MAPGIMPLESEQS:
- case MELTOBMAG_MAPLOOPS:
- case MELTOBMAG_MAPRTXS:
- case MELTOBMAG_MAPRTVECS:
- case MELTOBMAG_MAPBITMAPS:
- case MELTOBMAG_MAPSTRINGS:
- case MELTOBMAG_MAPBASICBLOCKS:
- case MELTOBMAG_MAPEDGES:
- case ALL_MELTOBMAG_SPECIAL_CASES:
- break;
- default:
- melt_fatal_error ("<%s#%ld> bad pointer %p (at %p) bad magic %d at %s:%d",
- msg, count, (void *) ptr, (void *) pptr,
- (int) ptr->u_discr->meltobj_magic, lbasename (filenam),
- lineno);
- }
+ magic = ptr->u_discr->meltobj_magic;
+ if (magic < MELTOBMAG__FIRST || magic >= MELTOBMAG__LAST)
+ melt_fatal_error ("<%s#%ld> bad pointer %p (at %p) bad magic %d at %s:%d",
+ msg, count, (void *) ptr, (void *) pptr,
+ (int) ptr->u_discr->meltobj_magic, lbasename (filenam),
+ lineno);
}
static long nbcheckcallframes;