Hi! Some of our (customer-) projects are compiled with GCC and the option ‘-fno-asm’. In this case, the compilation will fail with an error like: […]/Eigen/src/Core/products/GeneralBlockPanelKernel.h: (Ln: 642) error :'asm' was not declared in this scope Whith a newer GCC-version like 4.8.3, the error-message will show additionaly: test.cpp:19:2: note: in expansion of macro 'EIGEN_ASM_COMMENT' EIGEN_ASM_COMMENT("EIGEN PRODUCT PACK LHS"); ^ The GCC-documentation implies, that ‘-fno-asm’ may not affect the standard-keywords asm (and inline); but that’s no true (for the keyword asm). Similar to the header-file "Eigen\src\Core\util\Memory.h", which does already use the alternative keywords, following patch would solve this (small) issue: ---- Begin of (unified diff) patch ---- Index: Eigen/src/Core/arch/NEON/PacketMath.h =================================================================== --- Eigen/src/Core/arch/NEON/PacketMath.h (revision 222) +++ Eigen/src/Core/arch/NEON/PacketMath.h (working copy) @@ -50,7 +50,7 @@ #endif #ifndef __pld -#define __pld(x) asm volatile ( " pld [%[addr]]\n" :: [addr] "r" (x) : "cc" ); +#define __pld(x) __asm__ __volatile__ ( " pld [%[addr]]\n" :: [addr] "r" (x) : "cc" ); #endif template<> struct packet_traits<float> : default_packet_traits Index: Eigen/src/Core/util/Macros.h =================================================================== --- Eigen/src/Core/util/Macros.h (revision 222) +++ Eigen/src/Core/util/Macros.h (working copy) @@ -247,7 +247,7 @@ #if !defined(EIGEN_ASM_COMMENT) #if (defined __GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) - #define EIGEN_ASM_COMMENT(X) asm("#" X) + #define EIGEN_ASM_COMMENT(X) __asm__("#" X) #else #define EIGEN_ASM_COMMENT(X) #endif ---- End of (unified diff) patch ---- Ie., to use the alternative GCC-keyword(s), which are not affected by this GCC-option. Best regards from Salzburg, Markus
Thanks for the clear report. This looks like a bug in GCC (or the documentation) that should probably be reported to them. Having said that, given that we use __asm__ in Memory.h it seems sensible to be consistent and use __asm__ instead of asm everywhere. I was a bit worried about other non-GCC compilers, but it looks ICC is happy with __asm__ [1], the code in Eigen implies that clang is too, while Visual Studio interestingly seems to ignore any asm blocks and wants __asm instead [2]. Changesets: https://bitbucket.org/eigen/eigen/commits/f70fc7de (dev branch) https://bitbucket.org/eigen/eigen/commits/604d801e (3.2 branch) [1] https://software.intel.com/sites/products/documentation/doclib/iss/2013/compiler/cpp-lin/GUID-5100C4FC-BC2F-4E36-943A-120CFFFB4285.htm [2] http://msdn.microsoft.com/en-us/library/45yd4tzz.aspx
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/873.