GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » Fairroot » General Discussion » pointer handling in base/source/swaplw.c can fail on 64 bit systems
pointer handling in base/source/swaplw.c can fail on 64 bit systems [message #17814] Wed, 28 January 2015 19:15 Go to previous message
Volker Friese is currently offline  Volker Friese
Messages: 365
Registered: April 2004
Location: GSI CBM
first-grade participant
From: *dip0.t-ipconnect.de
Bug report of W. Müller, forwarded from the CbmRoot redmine:


The 1995 vintage code in base/source/swaplw.c uses the construct

switch ( (int) p_dest)
 {
      case 0:           /* source == destination /
     ...
     default:           / source != destination */
     ....
   }


The pointer to int cases causes a

warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]


warning in gcc. This construct will fail when p_dest is exactly
on a 4 GB border, in that case p_dest is != 0 but the cast int
will be zero (taking the lower 32 bit only). Unlikely, but possible.

This should be rephrased as

if (p_dest) {
     ....
  } else {
     ....
  }

 
Read Message
Read Message
Previous Topic: Certificate of FairRoot Redmine
Next Topic: Problem on running FairRoot tutorial macro
Goto Forum:
  


Current Time: Thu Mar 28 12:50:02 CET 2024

Total time taken to generate the page: 0.01103 seconds