Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2741ed91
Commit
2741ed91
authored
Mar 30, 2010
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build without -fno-strict-aliasing when gcc isn't buggy #3326
Patch from Daniel Stutzbach
parent
89d7b308
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
22 deletions
+77
-22
Misc/NEWS
Misc/NEWS
+3
-0
configure
configure
+57
-12
configure.in
configure.in
+17
-10
No files found.
Misc/NEWS
View file @
2741ed91
...
...
@@ -883,6 +883,9 @@ Extension Modules
Build
-----
- Issue #3326: Build Python without -fno-strict-aliasing when the gcc does not
give false warnings.
- Issue #1628484: The Makefile doesn't ignore the CFLAGS environment
variable anymore. It also forwards the LDFLAGS settings to the linker
when building a shared library.
...
...
configure
View file @
2741ed91
#! /bin/sh
# From configure.in Revision: 7
8965
.
# From configure.in Revision: 7
9401
.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for python 3.2.
#
...
...
@@ -4569,14 +4569,16 @@ UNIVERSAL_ARCH_FLAGS=
# tweak BASECFLAGS based on compiler and platform
case
$GCC
in
yes
)
# Python violates C99 rules, by casting between incompatible
# pointer types. GCC may generate bad code as a result of that,
# so use -fno-strict-aliasing if supported.
{
echo
"
$as_me
:
$LINENO
: checking whether
$CC
accepts -fno-strict-aliasing"
>
&5
echo
$ECHO_N
"checking whether
$CC
accepts -fno-strict-aliasing...
$ECHO_C
"
>
&6
;
}
# Python doesn't violate C99 aliasing rules, but older versions of
# GCC produce warnings for legal Python code. Enable
# -fno-strict-aliasing on versions of GCC that support but produce
# warnings. See Issue3326
{
echo
"
$as_me
:
$LINENO
: checking whether
$CC
accepts and needs -fno-strict-aliasing"
>
&5
echo
$ECHO_N
"checking whether
$CC
accepts and needs -fno-strict-aliasing...
$ECHO_C
"
>
&6
;
}
ac_save_cc
=
"
$CC
"
CC
=
"
$CC
-fno-strict-aliasing"
if
test
"
${
ac_cv_no_strict_aliasing_ok
+set
}
"
=
set
;
then
save_CFLAGS
=
"
$CFLAGS
"
if
test
"
${
ac_cv_no_strict_aliasing
+set
}
"
=
set
;
then
echo
$ECHO_N
"(cached)
$ECHO_C
"
>
&6
else
cat
>
conftest.
$ac_ext
<<
_ACEOF
...
...
@@ -4611,21 +4613,64 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
test
-z
"
$ac_c_werror_flag
"
||
test
!
-s
conftest.err
}
&&
test
-s
conftest.
$ac_objext
;
then
ac_cv_no_strict_aliasing_ok
=
yes
CC
=
"
$ac_save_cc
-fstrict-aliasing"
CFLAGS
=
"
$CFLAGS
-Werror -Wstrict-aliasing"
cat
>
conftest.
$ac_ext
<<
_ACEOF
/* confdefs.h. */
_ACEOF
cat
confdefs.h
>>
conftest.
$ac_ext
cat
>>
conftest.
$ac_ext
<<
_ACEOF
/* end confdefs.h. */
int
main ()
{
void f(int **x) {} int main() { double *x; f((int **) &x); return 0; }
;
return 0;
}
_ACEOF
rm
-f
conftest.
$ac_objext
if
{
(
ac_try
=
"
$ac_compile
"
case
"((
$ac_try
"
in
*
\"
*
|
*
\`
*
|
*
\\
*
)
ac_try_echo
=
\$
ac_try
;;
*
)
ac_try_echo
=
$ac_try
;;
esac
eval
"echo
\"\$
as_me:
$LINENO
:
$ac_try_echo
\"
"
)
>
&5
(
eval
"
$ac_compile
"
)
2>conftest.er1
ac_status
=
$?
grep
-v
'^ *+'
conftest.er1
>
conftest.err
rm
-f
conftest.er1
cat
conftest.err
>
&5
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
&&
{
test
-z
"
$ac_c_werror_flag
"
||
test
!
-s
conftest.err
}
&&
test
-s
conftest.
$ac_objext
;
then
ac_cv_no_strict_aliasing
=
no
else
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
ac_cv_no_strict_aliasing
=
yes
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
else
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
ac_cv_no_strict_aliasing
_ok
=
no
ac_cv_no_strict_aliasing
=
no
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
fi
CFLAGS
=
"
$save_CFLAGS
"
CC
=
"
$ac_save_cc
"
{
echo
"
$as_me
:
$LINENO
: result:
$ac_cv_no_strict_aliasing
_ok
"
>
&5
echo
"
${
ECHO_T
}
$ac_cv_no_strict_aliasing
_ok
"
>
&6
;
}
if
test
$ac_cv_no_strict_aliasing
_ok
=
yes
{
echo
"
$as_me
:
$LINENO
: result:
$ac_cv_no_strict_aliasing
"
>
&5
echo
"
${
ECHO_T
}
$ac_cv_no_strict_aliasing
"
>
&6
;
}
if
test
$ac_cv_no_strict_aliasing
=
yes
then
BASECFLAGS
=
"
$BASECFLAGS
-fno-strict-aliasing"
fi
...
...
configure.in
View file @
2741ed91
...
...
@@ -867,19 +867,26 @@ AC_SUBST(UNIVERSAL_ARCH_FLAGS)
# tweak BASECFLAGS based on compiler and platform
case $GCC in
yes)
# Python violates C99 rules, by casting between incompatible
# pointer types. GCC may generate bad code as a result of that,
# so use -fno-strict-aliasing if supported.
AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
# Python doesn't violate C99 aliasing rules, but older versions of
# GCC produce warnings for legal Python code. Enable
# -fno-strict-aliasing on versions of GCC that support but produce
# warnings. See Issue3326
AC_MSG_CHECKING(whether $CC accepts and needs -fno-strict-aliasing)
ac_save_cc="$CC"
CC="$CC -fno-strict-aliasing"
AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
AC_TRY_COMPILE([],[int main() { return 0; }],
ac_cv_no_strict_aliasing_ok=yes,
ac_cv_no_strict_aliasing_ok=no))
save_CFLAGS="$CFLAGS"
AC_CACHE_VAL(ac_cv_no_strict_aliasing,
AC_TRY_COMPILE([],[int main() { return 0; }],
CC="$ac_save_cc -fstrict-aliasing"
CFLAGS="$CFLAGS -Werror -Wstrict-aliasing"
AC_TRY_COMPILE([],[void f(int **x) {} int main() { double *x; f((int **) &x); return 0; }],
ac_cv_no_strict_aliasing=no,
ac_cv_no_strict_aliasing=yes),
ac_cv_no_strict_aliasing=no))
CFLAGS="$save_CFLAGS"
CC="$ac_save_cc"
AC_MSG_RESULT($ac_cv_no_strict_aliasing
_ok
)
if test $ac_cv_no_strict_aliasing
_ok
= yes
AC_MSG_RESULT($ac_cv_no_strict_aliasing)
if test $ac_cv_no_strict_aliasing = yes
then
BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment