Re: Method to specify initialization order across translation units?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> Combined, it resulted in the issue with the POD type initialization
>> (like a bool is no longer initialized when used), and issues with
>> libstdc++. So 250/300 is not the magic number...
>
> Of course not, if there was a magic number then everything would be
> initialized with that priority by default.
>
> Did you give the bool an init_priority?
>
> You need to work out which globals depend on each other and ensure
> that each one is initialized before anything that depends on it. If
> some of them depend on the bool then you need to ensure the bool is
> initialized before the objects that depend on it.

OK, the bool issue turned out to be a MS assembly block (consumed by
GCC) that lacked volatile. It was apparently removed by GCC, so it
caused a cascade of problems under Valgrind. The block was essentially
a one-liner that called CPUID.

The program is now clean under Valgrind and the Sanitizers (both GCC
and Clang). Its also clean under -Wall -Wextra. But the crash persists
under Cygwin at -O3 (Cygwin at -O2 is OK, and MinGW is OK).

I think I'm at the point of diminishing returns for a less frequently
used platform. I think I'm going to cut my loses now.

Thanks for the help.

Jeff



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux