Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 7881

reference to packed field is unaligned

$
0
0

I'm tyring to Upgrade a anchor program from 0.25.0 to 0.30.1 version. I'm getting this error on the structs

error[E0793]: reference to packed field is unaligned   --> programs/nodestore/src/lib.rs:302:15    |302 |         addel(&mut nds.pset, trf_purch_no);    |               ^^^^^^^^^^^^^    |    = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses    = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)    = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)

Is there a safe to to upgrade this program , Not break the current existing PDAs . All the structs have zero_copy implemented on them.


Viewing all articles
Browse latest Browse all 7881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>