Permalink
Browse files

Fix DELETE pointer type check

- prevents ptrcount underflow in the following typeDeref()

- an error will now always be shown if DELETE is used on something other
  than a pointer, not just a warning from the argument passed to the
  RTL function behind the scenes
  • Loading branch information...
1 parent d7242fe commit 53a36c4f5d7d71174f08965f42cdff431f0df974 @dkl dkl committed Jun 22, 2012
View
@@ -21,6 +21,7 @@ Version 0.24.0:
- The '= ANY' intializer on variables or fields will now prevent the default constructor call (if any), instead of generating a warning message, requiring the variable or field to be initialized with an explicit constructor call. It still won't affect destructor calls though.
- #3051592: crt/errno.bi now uses __errno_location() to access errno on Linux
- The NAKED keyword is now disallowed under -gen gcc because gcc doesn't support naked functions on x86
+- DELETE on something that's not a pointer now always triggers an error, not just a warning
[added]
- EVENT_MOUSE_HWHEEL for X11
@@ -250,7 +250,7 @@ sub cOperatorDelete()
dim as FBSYMBOL ptr subtype = astGetSubType( ptr_expr )
'' not a ptr?
- if( typeGet( dtype ) = FALSE ) then
+ if( typeIsPtr( dtype ) = FALSE ) then
errReport( FB_ERRMSG_EXPECTEDPOINTER )
hSkipStmt( )
return
@@ -0,0 +1,4 @@
+' TEST_MODE : COMPILE_ONLY_FAIL
+
+dim a as integer
+delete a
@@ -0,0 +1,4 @@
+' TEST_MODE : COMPILE_ONLY_FAIL
+
+dim a as single
+delete a
@@ -0,0 +1,4 @@
+' TEST_MODE : COMPILE_ONLY_FAIL
+
+dim a as string
+delete a
@@ -0,0 +1,8 @@
+' TEST_MODE : COMPILE_ONLY_FAIL
+
+type T
+ a as integer
+end type
+
+dim a as T
+delete a

0 comments on commit 53a36c4

Please sign in to comment.