Open cgay opened 11 years ago
The variable/constant needn't be a thread variable. I just ran into the same problem with protocol buffers, in which I tried to update an $introspection-data
table with top-level code that occurred in a file before it was defined.
Since we do library-at-a-time compilation, I assume that we have a view of all the definitions regardless of file. We may or may not currently be able to infer a complete ordering? It would be great if we could emit a serious warning for such code ("attempt to use $introspection-data
which is not yet initialized") and not segfault.
I'm dropping this here on the theory that it's a similar/related issue.
I have top-level code that makes an instance of <dylan-field-descriptor-proto>
, which is defined in a subsequent file. (I'm pretty certain this is illegal, so this is really just about improving the failure mode.) The test suite dies with this error when it attempts to access a field in the class via field-descriptor-proto-name
. So I'm guessing that the top-level code that makes the instance somehow executes without error but hasn't correctly initialized the class object?
$ $PB/../_build/bin/protocol-buffers-test-suite --debug crashes --test 'test-<file-descriptor-set>-introspection'
Test test-<file-descriptor-set>-introspection:
#f is not of type {<class>: <integer>}
Backtrace:
0
default-handler:dylan:dylan##1 + 0x12
0x79643a6e616c7964
default-last-handler:common-dylan-internals:common-dylan##0 + 0x2f6
error:dylan:dylan##0 + 0x27
type-check-error:internal:dylan + 0x6d
make-slot-access-engine-node:dispatch-engine-internal:dylan + 0x238
transmogrify-method-list-grounded:dispatch-engine-internal:dylan + 0x28c
compute-terminal-engine-node:dispatch-engine-internal:dylan + 0x8b
compute-discriminator-for-arg:dispatch-engine-internal:dylan + 0x2a4
compute-dispatch-from-root:dispatch-engine-internal:dylan + 0x2b
Kanonymous_of_PPtest_Lfile_descriptor_setG_introspectionF51I + 0x13
do-check-equal:%testworks:testworks + 0x335
%%test-<file-descriptor-set>-introspection:protocol-buffers-test-suite:protocol-buffers-test-suite + 0x261
Kanonymous_of_execute_componentF95I + 0x360
do-with-profiling:common-dylan-internals:common-dylan + 0x2f
execute-component:%testworks:testworks##1 + 0x2cd
maybe-execute-component:%testworks:testworks##0 + 0x193
run-tests:testworks:testworks + 0x88
run-or-list-tests:%testworks:testworks + 0x71
run-test-application:testworks:testworks + 0x413
main + 0x19
__libc_start_main + 0xea
_start + 0x2a
Open Dylan 2013.1 OS X
In testworks I was rearranging the code into different files and started getting a segfault during library initialization. It was fairly hard to debug. Turned out to be a forward reference to a thread variable in a different file. i.e., the file occurred later in the LID file. Here's a library that reproduces the problem: