On Tue, Jun 20, 2023 at 4:21 PM Miro Karpis <miroslav.kar...@gmail.com> wrote:
>
> Hi,
> This one is giving me really hard time. I'm trying to build crypto++ with 
> msvc / windows - compilation works fine, but always when I want to use the 
> lib I keep getting
>
>  block at 0x000001362708B180 was not allocated by _aligned routines, use 
> free()
>
> After debugging the code I can see that the problem is in allocate.cpp
>
> void AlignedDeallocate(void *p)
> {
> // Guard pointer due to crash on AIX when CRYPTOPP_NO_ALIGNED_ALLOC
> // is in effect. The guard was previously in place in SecBlock,
> // but it was removed at f4d68353ca7c as part of GH #875.
> CRYPTOPP_ASSERT(p);
>
> if (p != NULLPTR)
> {
> #ifdef CRYPTOPP_MM_MALLOC_AVAILABLE
> _mm_free(p);
> #elif defined(CRYPTOPP_NO_ALIGNED_ALLOC)
> p = (byte *)p - ((byte *)p)[-1];
> free(p);
> #else
> free(p);
> #endif
> }
> }
>
> If I understand it correctly then the allocation wasn't done with aligned, 
> but with malloc?
> Did anyone had similar issue?
>
> Just on the side I'm of course hitting the old, where _MSC_VER and __clang__ 
> are defined. SO far I haven't find any workaround on this either.
>
> // discussed at http://github.com/weidai11/cryptopp/issues/147.
> #if (defined(_MSC_VER) && defined(__clang__) && \
>    !(defined( __clang_analyzer__)) && !defined(__INTEL_LLVM_COMPILER))
> # error: "Unsupported configuration"
> #endif
>
>
> Will be more than thankful for any kind of help in this.

Yeah, that's the age-old Clang bug. Clang pretends to be other
compilers via #defines, but then it cannot consume the program for the
compiler it is pretending to be.

We have code paths setup for Clang. Clang needs to stop pretending to
be other compilers, and stay in its own lane.

File a bug report against Clang for it. Or don't use Clang in this case.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8nm%2Bonk8-NVjbUqozc3tQxgPVAv5Kaicg5VHK1A2QoXPg%40mail.gmail.com.

Reply via email to