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 next 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 {
     ....
  }

Re: pointer handling in base/source/swaplw.c can fail on 64 bit systems [message #17817 is a reply to message #17814] Thu, 29 January 2015 11:13 Go to previous message
Dmytro Kresan is currently offline  Dmytro Kresan
Messages: 166
Registered: June 2004
first-grade participant
From: *gsi.de
Hello Volker,
I will implement the changes you proposed.
Best regards,
Dima
Previous Topic: Certificate of FairRoot Redmine
Next Topic: Problem on running FairRoot tutorial macro
Goto Forum:
  


Current Time: Mon Nov 04 06:46:39 CET 2024

Total time taken to generate the page: 0.00504 seconds