[New-bugs-announce] [issue29279] --with-pydebug optimizes too much

Arcadiy Ivanov report at bugs.python.org
Sun Jan 15 03:17:47 EST 2017

New submission from Arcadiy Ivanov:

Around line 1480 of configure.ac:
	    if test "$Py_DEBUG" = 'true' ; then
		# Optimization messes up debuggers, so turn it off for
		# debug builds.
                if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then
                    OPT="-g -Og -Wall $STRICT_PROTO"
                    OPT="-g -O0 -Wall $STRICT_PROTO"
		OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"

The "-Og", unfortunately, optimizes too much resulting in local variables and arguments being optimized out:

(gdb) info locals
kwlist = {0x7ffff02c3318 "database", 0x7ffff02c3321 "timeout", 0x7ffff02c3329 "detect_types", 0x7ffff02c3336 "isolation_level", 0x7ffff02c3346 "check_same_thread", 0x7ffff02c3392 "factory", 0x7ffff02c3358 "cached_statements", 
  0x7ffff02c336a "uri", 0x0}
database = 0x7ffff04f7da0 ":memory:"
detect_types = 0
isolation_level = 0x1
factory = 0x7ffff04c7dc0 <pysqlite_ConnectionType>
check_same_thread = 1
cached_statements = 4888694
uri = 0
timeout = 5
(gdb) info args
self = <optimized out>
args = 0x7fffeff6be28
kwargs = 0x0

When "self" is optimized out it's too much optimization for debug mode.

components: Build
messages: 285505
nosy: arcivanov
priority: normal
severity: normal
status: open
title: --with-pydebug optimizes too much
versions: Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list