Power Programming Languages

Power Programming Languages

IBM Power, including the AIX, IBM i, and Linux operating systems, support a wide range of programming languages, catering to both traditional enterprise applications and modern development needs.


#Power


#Servers
#Programminglanguages
 View Only

The -qcheck=stackclobber suboption

By Archive User posted 09/23/14 02:13 AM

  

Originally posted by: Cecilia_F


In XL C/C++ for AIX, V13.1, a new suboption, stackclobber, is added to the -qcheck option to detect stack corruption of nonvolatile registers in the save area in user programs. This type of corruption happens only if any of the nonvolatile registers in the save area of the stack is modified. When such violation is encountered, a runtime error will be raised by sending a SIGTRAP signal to the process.
 
Here's an example that shows the effect of -qcheck=stackclobber:
 
void func4(char *p, int off, int value) {
  *(p+off)=value;
}
 
int foo() {
  int i;
  char boo[9];
  i=24;                           
  func4(boo, i, 66);
  /* Traps here */
  return 0;                   
}
 
int main() {
  foo();
}
 
In this example, the offset is subject to change at different optimization level. When -O2 or lower optimization level is in effect, func4 will clobber the save area of foo because *(p+off) is in the save area. 

#C/C++-compilers-for-AIX
#C/C++andFortran
0 comments
0 views

Permalink