google / pdl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Array element size (20) is not a multiple of 8

mgeisler opened this issue · comments

The following PDL file crashes backends::rust::generate despite passing through the analyzer:

little_endian_packets

struct PcapHeader {
  _fixed_ = 0xa1b2cd4: 32,
}

struct PcapRecord {
  ts_sec: 20,
}

packet PcapFile {
  header: PcapHeader,
  records: PcapRecord[],
}

Stack trace:

thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `4`,
 right: `0`: Array element size (20) is not a multiple of 8', /home/mgeisler/src/pdl/src/backends/rust/parser.rs:289:17
stack backtrace:
   0: begin_panic_handler
             at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library/std/src/panicking.rs:593:5
   1: panic_fmt
             at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library/core/src/panicking.rs:67:14
   2: assert_failed_inner
   3: core::panicking::assert_failed
             at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library/core/src/panicking.rs:228:5
   4: pdl_compiler::backends::rust::parser::FieldParser::add_array_field
             at ./src/backends/rust/parser.rs:289:17
   5: pdl_compiler::backends::rust::parser::FieldParser::add
             at ./src/backends/rust/parser.rs:67:71
   6: pdl_compiler::backends::rust::generate_data_struct
             at ./src/backends/rust.rs:236:9
   7: pdl_compiler::backends::rust::generate_packet_decl
             at ./src/backends/rust.rs:579:48
   8: pdl_compiler::backends::rust::generate_decl
             at ./src/backends/rust.rs:972:45
   9: pdl_compiler::backends::rust::generate::{{closure}}
             at ./src/backends/rust.rs:998:53