Re: [eigen] SEGFAULTs after changeset 537b5d33b440 (+patch) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] SEGFAULTs after changeset 537b5d33b440 (+patch)
- From: hauke strasdat <strasdat@xxxxxxxxx>
- Date: Sat, 8 Jan 2011 18:00:18 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=Bwjv3FlbnFGkty1BA5Cnls5Ncuqnkd5ijzO7h6MSNTw=; b=fOYZHkvFrNP7q2kkPUyE2gnHjDnbNK+d3Oh5u/5d79KP0hxOk9s1Fr+nxrxAovXg+z 1dY8YCWc5ks2kLjw4JDAhCSLIqKZDsQyjWwpqdc2wRIXBgSohjw+8C+dxeYMe3WP+o9F H7GFoqwAHHoa2YBG9nIUeILNf/tKU0z7sHdjI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=nNOsCDZrwwhHLJQt01w1X5DflxMVowD3RIvMJIS/t0BdhLvlDRP4G1EKilChTP1YzG BM6KLcLeOpMbXSCwquuhfEB3irPsG8xvFCxiBRaoJF1LCMvOQBu2F8GC1HhxdRzb901k IvqAeZOm4Ns70HxcJPgfU6bFQNPLysfG/vWxQ=
Hi,
Jose Luis, thanks for figuring this out! Is this fixed already in the
repository? (Sorry, I am still learning hg...)
Cheers,
Hauke
On Wed, Jan 5, 2011 at 2:16 AM, Jose Luis Blanco
<joseluisblancoc@xxxxxxxxx> wrote:
> Hi all,
>
> I've been struggling this last week to find out why *several* parts of
> my code suddenly stopped working with Eigen3, and I finally nailed
> down the specific change that makes the code crashes, and it's about
> the CPUID macros changed in 537b5d33b440.
> It turned out that the logic of the #if's wasn't maintained in the
> change, and it seems to me that the "xchgl ..." instruction was
> invoked instead of the "cpuid...".
>
> I attach a patch that fixes it (tested in gcc + amd64), but please,
> someone with a good understanding of what is the __PIC__ supposed to
> do here, take a careful look at the resulting code:
>
> ===============================
> //---------- Cache sizes ----------
>
> #if defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
> # if defined(__PIC__) && defined(__i386__)
> // Case for x86 with PIC
> # define EIGEN_CPUID(abcd,func,id) \
> __asm__ __volatile__ ("xchgl %%ebx, %%esi;cpuid; xchgl
> %%ebx,%%esi": "=a" (abcd[0]), "=S" (abcd[1]), "=c" (abcd[2]), "=d"
> (abcd[3]) : "a" (func), "c" (id));
> # else
> // Case for x86_64 or x86 w/o PIC
> # define EIGEN_CPUID(abcd,func,id) \
> __asm__ __volatile__ ("cpuid": "=a" (abcd[0]), "=b" (abcd[1]),
> "=c" (abcd[2]), "=d" (abcd[3]) : "a" (func), "c" (id) );
> # endif
> #elif defined(_MSC_VER)
> # if (_MSC_VER > 1500) /* newer than MSVC++ 9.0 */ || (_MSC_VER ==
> 1500 && _MSC_FULL_VER >= 150030729) /* MSVC++ 9.0 with SP1*/
> # define EIGEN_CPUID(abcd,func,id) __cpuidex((int*)abcd,func,id)
> # endif
> #endif
>
> ===============================
>
> btw, if it helps, in all my builds __PIC__ seems to be predefined by GCC.
>
> Thanks in advance!
>
> JL
>