Bug 66752 - GCC version check in sna/compiler.h is incorrect
Summary: GCC version check in sna/compiler.h is incorrect
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Chris Wilson
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-10 03:04 UTC by Thomas Jones
Modified: 2013-07-10 11:06 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
patch that fixes the problem (574 bytes, patch)
2013-07-10 03:28 UTC, Thomas Jones
no flags Details | Splinter Review

Description Thomas Jones 2013-07-10 03:04:25 UTC
The following is causing compile errors for me because gcc 4.5 does not have the -Ofast option

#if HAS_GCC(4, 5) && defined(__OPTIMIZE__)
#define fast_memcpy __attribute__((optimize("Ofast"))) __attribute__((target("inline-all-stringops")))
#else
#define fast_memcpy
#endif

It could be corrected if this is done instead

#if HAS_GCC(4, 6) && defined(__OPTIMIZE__)
#define fast_memcpy __attribute__((optimize("Ofast"))) __attribute__((target("inline-all-stringops")))
#if HAS_GCC(4, 5) && defined(__OPTIMIZE__)
#define fast_memcpy __attribute__((target("inline-all-stringops")))
#else
#define fast_memcpy
#endif
Comment 1 Thomas Jones 2013-07-10 03:05:35 UTC
Whoops the corrected code should actually be:

#if HAS_GCC(4, 6) && defined(__OPTIMIZE__)
#define fast_memcpy __attribute__((optimize("Ofast"))) __attribute__((target("inline-all-stringops")))
#elif HAS_GCC(4, 5) && defined(__OPTIMIZE__)
#define fast_memcpy __attribute__((target("inline-all-stringops")))
#else
#define fast_memcpy
#endif
Comment 2 Thomas Jones 2013-07-10 03:28:25 UTC
Created attachment 82249 [details] [review]
patch that fixes the problem
Comment 3 Chris Wilson 2013-07-10 11:06:59 UTC
commit a18f4ba9033cec3cc435c29878b12ceef1defc1f
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jul 10 11:56:50 2013 +0100

    sna: Ofast was introduced with gcc-4.6
    
    Thomas Jones reported that the build was failing with gcc-4.5 due to the
    memcpy routines requesting an unsupported optimisation mode (-Ofast) and
    supplied this patch to only enable Ofast for gcc-4.6+
    
    Reported-by: Thomas Jones <thomas.jones@utoronto.ca>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Bah, missed the bugzilla tag.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.