From 51a5fdfbd723dd1dd4f240565c0abe420ce98a0d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= <vsc@xato.(none)>
Date: Wed, 2 Feb 2011 20:14:36 +0000
Subject: [PATCH] fix handling of SICStus style attributes (obs from Denys
 Duchier).

---
 C/attvar.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/C/attvar.c b/C/attvar.c
index fb0249ce3..a27f4b925 100644
--- a/C/attvar.c
+++ b/C/attvar.c
@@ -569,6 +569,13 @@ p_put_atts(void) {
     }
     /* we may have a stack shift meanwhile!! */ 
     tatts = Deref(ARG2);
+    if (IsVarTerm(tatts)) {
+      Yap_Error(INSTANTIATION_ERROR,tatts,"second argument of put_att/2");
+      return FALSE;
+    } else if (!IsApplTerm(tatts)) {
+      Yap_Error(TYPE_ERROR_COMPOUND,tatts,"second argument of put_att/2");
+      return FALSE;
+    }
     if (IsVarTerm(otatts = SearchAttsForModule(attv->Atts,mfun))) {
       AddNewModule(attv,tatts,new,FALSE);
     } else {