Control: tags -1 pending Ok, before uploading the fix, this error needs some documentation, as this is a quite weird one; and I'm not 100% sure if this not a gcc bug.
The bug is in tcfdbloadmeta(), where TC tries to load and parse the meta data. Its bascially always "memcpy some bytes to a temp var, do endianess correction and store result into struct. (The function is quoted below, for easier referncing) gdb'ing into it, it shows that the metadata is correctly loaded in to the buffer (hbuf) but not correctly stored restored. As an example, the failing testcase creates a TC DB with fdb->width = 50; this information is stored in the file with offset=64. Memdump of hbuf shows that the expected value is there... However, fdb->width is 0 after tcfdbloadmeta()... A tatical "volatile" before the local fixes that... I'm not really sure if gcc is allowed to do such optimizations... The func: /* Deserialize meta data from a buffer. `fdb' specifies the fixed-length database object. `hbuf' specifies the buffer. */ static void tcfdbloadmeta(TCFDB *fdb, const char *hbuf){ memcpy(&(fdb->type), hbuf + FDBTYPEOFF, sizeof(fdb->type)); memcpy(&(fdb->flags), hbuf + FDBFLAGSOFF, sizeof(fdb->flags)); volatile uint64_t llnum; // << the volatile is added to fix this. memcpy(&llnum, hbuf + FDBRNUMOFF, sizeof(llnum)); fdb->rnum = TCITOHLL(llnum); memcpy(&llnum, hbuf + FDBFSIZOFF, sizeof(llnum)); fdb->fsiz = TCITOHLL(llnum); memcpy(&llnum, hbuf + FDBWIDTHOFF, sizeof(llnum)); fdb->width = TCITOHLL(llnum); memcpy(&llnum, hbuf + FDBLIMSIZOFF, sizeof(llnum)); fdb->limsiz = TCITOHLL(llnum); memcpy(&llnum, hbuf + FDBMINOFF, sizeof(llnum)); fdb->min = TCITOHLL(llnum); memcpy(&llnum, hbuf + FDBMAXOFF, sizeof(llnum)); fdb->max = TCITOHLL(llnum); } -- tobi