bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] Possible problems with python (maybe specifically python


From: Michael Petch
Subject: Re: [Bug-gnubg] Possible problems with python (maybe specifically python 2.7) - FINDINGS
Date: Sat, 14 May 2011 03:14:38 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10

Howdy,

The issue is with newer versions of Clang 2.9 in the past few months
when compile time array-bounds checking was added to clang. The
array-bounds checking can create false positives under certain
circumstances. The way Python defines and allocates its objects is one
such situation. The end result are these warnings.

There is an array of pointers (set to a size of 1) in PyTupleObject;s
definition, but when PyTuple_New is called memory is allocated to allow
the array of 1 to be of a variable size. The compiler thinks it is
overwriting the array of 1, but object creation has already set aside
extra space at run time.

The error can be ignored. If you wish to use clang and use
-Warray-bounds and not receive these warnings then gnubgmodule.c can
have the PyTuple_SET_ITEM usage modified slightly.  An example from
gnubgmodule.c that throws warnings:

  PyTuple_SET_ITEM(b, 0, b0);
  PyTuple_SET_ITEM(b, 1, b1);

Change it to

 int index = 0;
 PyTuple_SET_ITEM(b,     index, b0);
 PyTuple_SET_ITEM(b, ++index, b1);

After further investigation, we aren't along in running across these
-Warray-bounds false positives.

-- 
Michael Petch
CApp::Sysware Consulting Ltd.
OpenPGP FingerPrint=D81C 6A0D 987E 7DA5 3219 6715 466A 2ACE 5CAE 3304




reply via email to

[Prev in Thread] Current Thread [Next in Thread]