CILK gives one an almost effortless way to speed up programs by converting serial to multithreaded code. There is a minor annoyance that I request help with.
I usually develop without CILK first. Once in a while, I will have some global counters that I increment inside heavily used functions. After the program is debugged I usually remove these variables before CILK-izing the code, but once in a while one or two get left behind, and when the multithreaded program is run the speed increase is disappointing because of the different threads contending for access to the global variables. Sometimes the program results are wrong, and one needs to remember that one source of error is writing to global variables without securing sole access.
If the multithreaded program runs more slowly than the serial version, I can take it as a tell-tale sign that there are some orphan global variables in my sources. If not, and it is not clear why parallelization has not worked well, I can fire up Intel Inspector and look at the program, but this is a rather time-consuming way of locating those wayward variables.
My request: would it be possible for the compiler, when it sees global variables in a function that is invoked with a "cilk_spawn" prefix elsewhere, to issue a warning that global variables can cause problems when written to with no discipline in multithreaded programs?