| Summary: | G4ExtrudedSolid bad access fault in G4.10.4.0 (array index problem) | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Laurie Nevay <laurie.nevay> |
| Component: | geometry/solids | Assignee: | Evgueni.Tcherniaev |
| Status: | RESOLVED FIXED | ||
| Severity: | major | ||
| Priority: | P4 | ||
| Version: | other | ||
| Hardware: | Apple | ||
| OS: | Mac OS X | ||
| Attachments: |
Line where error occurs
Stack trace showing some indicative values. Points used for extruded solid. Plot of shape transverse. 2 zsections with same scale for simple extrusion. |
||
Created attachment 478 [details]
Stack trace showing some indicative values.
Created attachment 479 [details]
Points used for extruded solid.
Created attachment 480 [details]
Plot of shape transverse.
Created attachment 481 [details]
2 zsections with same scale for simple extrusion.
Dear Laurie, Thank you for reporting the problem. The source of the problem has been identified. To speed up G4ExtrudedSolid for the case of simple extrusion, some new members have been introduced, but the copy constructor and the assignment operator have not been modified. Silly mistake! Fix will be available in the Geant4 repository beginning of the next week. In case if you need a to fix it quickly, then add one line in the constructor and one line in the assignment operator, see middle lines below: Copy constructor: ... fSolidType(rhs.fSolidType), fPlanes(rhs.fPlanes), fLines(rhs.fLines), fLengths(rhs.fLengths), fKScales(rhs.fKScales), fScale0s(rhs.fScale0s), ... Assignment: ... fSolidType = rhs.fSolidType; fPlanes = rhs.fPlanes; fLines = rhs.fLines; fLengths = rhs.fLengths; fKScales = rhs.fKScales; fScale0s = rhs.fScale0s; ... Best regards, Evgueni Thanks for the quick response and fix. Yes, this fixes it indeed. Many thanks! Laurie |
Created attachment 477 [details] Line where error occurs With Geant4.10.4.0 I find our geometry fails with a bad access error - ie this is trying to access outside an array. I have a G4ExtrudedSolid and I try to place a G4CutTubs in it. The bad access happens in the placement because of checkOverlaps=true. Compiling Geant4 with debug build shows this is in testing whether a point lies inside the solid. G4PVPlacement::CheckOverlaps -> G4ExtrudedSolid::Inside -> G4ExtrudedSolid::PointInPolygon *problem This access a member std::vector called fLines with an index ranging from 0 -> len(extruded points) (12 in my case). fLines is empty though resulting in a bad access. I attach the points used for the G4ExtrudedSolid and screenshots of a stack trace in the CLion IDE. There is a possibility I'm constructing the solid incorrectly, but this worked with Geant4.10.0 -> 4.10.3.p03 without problem. I believe irrespective of how I construct the solid, we shouldn't experience an array index problem though. Any help would be appreciated. I'm also based at CERN if any developer is there and needs to see it reproduced.