Revision: 77112
http://sourceforge.net/p/brlcad/code/77112
Author: starseeker
Date: 2020-09-12 19:08:22 +0000 (Sat, 12 Sep 2020)
Log Message:
-----------
Workaround for struct parsing failures on GhostBSD
Was getting 'Structure inconsistency detected parsing 'width'' bombs
on one of the GhostBSD optimized distcheck configs with rtedge. gdb
session shows us simply entering the parse_struct_lookup function,
starting to iterate over the structures loop, skipping the loc
calculation completely, and jumping right to the loc==NULL test. In
this case loc has a value of NULL rather than a garbage value, so we
bomb out.
Assigning the (base + sdp->sp_offset) calculation result as an
initialization to loc also results in loc == NULL, as does printing
the calculation's numerical value in a bu_log, but when run
interactively in the gdb session the same expression evaluates
non-zero.
Work around this by checking for a NULL base, and in that case use the
sdp->sp_offset value without attempting to add the NULL base to it.
Still not clear why some compile settings appear to be producing
different behaviors evaluating this expression, but on GhostBSD at
least this seems to avoid the issue and let the regression tests
succeed...
Modified Paths:
--------------
brlcad/branches/RELEASE/src/libbu/parse.c
Modified: brlcad/branches/RELEASE/src/libbu/parse.c
===================================================================
--- brlcad/branches/RELEASE/src/libbu/parse.c 2020-09-12 16:47:48 UTC (rev
77111)
+++ brlcad/branches/RELEASE/src/libbu/parse.c 2020-09-12 19:08:22 UTC (rev
77112)
@@ -685,7 +685,15 @@
/* iterate over all structure entries and look for a match */
for (; sdp->sp_name != (char *)0; sdp++) {
- loc = (char *)(base + sdp->sp_offset);
+ // Optimized GhostBSD sometimes results in this calculation evaluating
+ // to zero/NULL when base == NULL, even when sdp->sp_offset is
+ // non-zero??? Only try the math if we have a non-null base to start
+ // with - otherwise just use the offset.
+ if (base) {
+ loc = (char *)(base + sdp->sp_offset);
+ } else {
+ loc = (char *)(sdp->sp_offset);
+ }
if (UNLIKELY(loc == NULL)) {
bu_log("Structure inconsistency detected parsing '%s'\n",
sdp->sp_name ? sdp->sp_name : "NULL");
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits