Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix so will compile -O0 -g #9725

Merged
merged 1 commit into from Jun 24, 2015
Merged

Conversation

wddgit
Copy link
Contributor

@wddgit wddgit commented Jun 22, 2015

Fix so that TrackingLayer will compile
with -O0 0g flags.

Fix so that TrackingLayer will compile
with -O0 0g flags.
@cmsbuild
Copy link
Contributor

A new Pull Request was created by @wddgit (W. David Dagenhart) for CMSSW_7_5_X.

Bug fix so will compile -O0 -g

It involves the following packages:

FastSimulation/Tracking

@cmsbuild, @ssekmen, @civanch, @mdhildreth, @lveldere can you please review it and eventually sign? Thanks.
@Martin-Grunewald, @matt-komm this is something you requested to watch as well.
You can sign-off by replying to this message having '+1' in the first line of your reply.
You can reject by replying to this message having '-1' in the first line of your reply.
If you are a L2 or a release manager you can ask for tests by saying 'please test' in the first line of a comment.
@Degano you are the release manager for this.
You can merge this pull request by typing 'merge' in the first line of your comment.

@lveldere
Copy link
Contributor

please test

@lveldere
Copy link
Contributor

@wddgit

Hi David

Would you mind explaining me what this new line actually does?

Thanks

Lukas

@cmsbuild
Copy link
Contributor

The tests are being triggered in jenkins.

@wddgit
Copy link
Contributor Author

wddgit commented Jun 22, 2015

Hi. There is a static data member of the class TrackingLayer that
is declared, but it is never defined. Normally the definition should
appear once in the .cc file while the declaration is in the header and
appears everywhere the header is included. In some cases, you
can get away with never defining such statics, but in this case
the variable is used as a functor. The gcc compiler on the computer
I use gives the following link error because it is not defined. (I think the
compiler is correct in this case, although I do not know enough to
quote the specific section of the C++ standard).

/build/wdd/reldebugbuild/CMSSW_7_5_X_2015-06-20-1100/src/FastSimulation/Tracking/interface/TrackingLayer.h:92: undefined reference to `TrackingLayer::_eqfct'

Finally, the error only shows up when the -O0 -g options are passed to the
compiler. These turn off the optimizer and include debugging information.
I believe in other cases the optimizer removes the offending code before
the linker ever sees it and complains.

@cmsbuild
Copy link
Contributor

@lveldere
Copy link
Contributor

Thanks you.
One more question before I approve:
Why is there no similar line required for TrackingLayer::_hashfct?

const TrackingLayer::hashfct TrackingLayer::_hashfct;

@davidlt
Copy link
Contributor

davidlt commented Jun 24, 2015

It depends on how _hashfct is being used in the code. If it's odr-used, then symbol is required.

$ git grep _hashfct
FastSimulation/Tracking/interface/TrackingLayer.h:        static const hashfct _hashfct;
FastSimulation/Tracking/interface/TrackingLayer.h:            return _hashfct(*this)<_hashfct(layer);

It's not odr-used IIUC.

@lveldere
Copy link
Contributor

+1

thanks

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_5_X IBs once checked with relvals in the development release cycle of CMSSW (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @davidlange6, @Degano, @smuzaffar

@davidlange6
Copy link
Contributor

+1

@wddgit
Copy link
Contributor Author

wddgit commented Jun 24, 2015

_hashfct is not a problem because it is only used in one inline function and the inline function that uses it is never called. It is not odr used, because it is not used at all. I suspect if it did get used in a part of the code that was compiled it would also be a problem, although these rules are complex enough I could be wrong. I did not test this. I did not fix that one simply because I did not notice it, the compiler did not give an error.

@wddgit wddgit deleted the fixCompilation branch September 23, 2016 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants