Using derived storage pointer instead of constant when passing as argument to macro breaks
The following snippets are identical in theory:
#define constant SWAG = 0x00
#define macro M(slot) = {
<slot> sload 0x00 mstore 0x14 0x00 return
}
#define macro MAIN() = {
M(SWAG)
}
#define constant SWAG = FREE_STORAGE_POINTER()
#define macro M(slot) = {
<slot> sload 0x00 mstore 0x14 0x00 return
}
#define macro MAIN() = {
M(SWAG)
}
But the latter errors without context with Error: Storage Pointers Not Derived.
Seems to be a bug?
The macro TEST will not insert SLOT_SOMETHING into the stack (silently fail) if it's referred to this way:
#define constant SLOT_SOMETHING = FREE_STORAGE_POINTER()
#define macro TEST() = {
0x01
<SLOT_SOMETHING> sstore
}
#define macro MAIN() = {
TEST()
}
Generating bytecode 60038060093d393df3600155. Having SLOT_SOMETHING be accessed with [SLOT_SOMETHING] instead means 60058060093d393df36001600055.
Doing this in MAIN is a different story:
#define constant SLOT_SOMETHING = FREE_STORAGE_POINTER()
#define macro MAIN() = {
0x01
<SLOT_SOMETHING> sstore
}
In the above example it fails with:
[31m
Error: Unmatched Jump Label
[0m
huffc: exit 1
The original issue has been merged in, could you make the second comment into another issue please so its easier to triage! Appreciate you finding these issues :):)