Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with nested typed SETF #466

Open
oldk1331 opened this issue Dec 2, 2023 · 0 comments
Open

error with nested typed SETF #466

oldk1331 opened this issue Dec 2, 2023 · 0 comments

Comments

@oldk1331
Copy link

oldk1331 commented Dec 2, 2023

Minimal reproducible example:

(defun GETREFV_U32 (n x)
    (make-array n :initial-element x
               :element-type '(unsigned-byte 32)))

(defmacro SETELT_U32 (v i s)
    `(setf (aref (the (simple-array (unsigned-byte 32) (*)) ,v) ,i)
           ,s))

(DEFUN t1 (M J)
  (BLOCK SEQ
    (SETELT_U32 M J (SETELT_U32 M J 1))
    (RETURN-FROM SEQ NIL))
)

When running t1 with simple arguments:

? (t1 (GETREFV_U32 5 2) 1)
> Error: Error reporting error

If I redefine error handler, I can get:

The value #<BOGUS object @ #xFFFFFFF800000007> is not of the expected type (UNSIGNED-BYTE 32).

The value xFFFFFFF800000007 shows in (disassemble #'t1).

If the type declaration is removed, then there's no error. There's also no error if the nested SETELT_U32 is rewrite as 2 consecutive SETELT_U32 with the help of a temp variable.

So I guess this bug happens somewhere in the compiler's optimizer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant