[Dune] Problem with latest dune-common / strangy error message with quadmath.hh

Benedikt Oswald benedikt.oswald at aquante.ch
Tue Dec 9 15:40:27 CET 2025


Dear Christoph, thanks for your reply!

In fact I was just debugging this problem...thought transmission,

yes, I use a clean gcc 15.1 (from homebrew) and openmpi compilers

based on this gcc version.


It seems that there are collisions between quadmath.hh and the 
superlu_zdesfs.h declarations.


Using Google Antigravity as my new IDE it gave me this explanation & 
fix, which works:

************************************************************************************************************************************************************************

I have analyzed the error and it confirms our suspicion:*SuperLU_DIST is 
defining*

*|fma|*

*as a macro*, which breaks the

|dune/common/quadmath.hh|

header where it tries to declare a function named

|fma|

.


      Why this happens

 1. *The Collision*: The error

    |expected initializer before '&' token|

    at

    |inline Float128 fma(...)|

    means the preprocessor has replaced

    |fma|

    with something else (garbage code or an internal function name)
    before the compiler sees it. This turns a valid function declaration
    like

    |inline Float128 fma(...)|

    into valid syntax failure.
 2. *The Trigger*: Including
    solver3ddgfd.hhcauses the issue because it includes
    superludistsolverinterface.hh, which imports

    |superlu_zdefs.h|

    . This external header defines the

    |fma|

    macro, polluting the global namespace for any file processed
    afterwards (like

    |quadmath.hh|

    ).


      The Fix

I have applied a fix to

dune/demokritos3d/algebra/sparse/direct/superludistsolverinterface.hh.

cpp
#include"superlu_zdefs.h"
// };
// Fix collision with std::fma and other libraries
#ifdeffma
#undeffma
#endif

************************************************************************************************************************************************************************



It is not a problem of the C 23 standard, I just checked this.


Do you think you can


Greetings, Benedikt









On 09.12.2025 15:16, Christoph Grüninger wrote:
> Hi Benedikt,
> I have no idea. quadmath.hh remains unchanged for over three years.
>
> 1. Have you checked that the standard library is matching your 
> compiler? Using GCC I would expect you are linking to libstdc++ and 
> not Clang's libc++, right?
> 2. Given C++23 introduced std::float128_t, we might want to update 
> quadmath.hh to use the standard type when available.
> Maybe the internal change to support the standard type for C++23 
> changed something? We defined a float128_t in our Impl namespace in 
> quadmath.hh:32.
>
> Kind regards,
> Christoph
>
>
> Am 08.12.25 um 18:48 schrieb Benedikt Oswald:
>> Dear Dune,
>>
>> using the latest dune git versions, I encounter this error:
>>
>> ----------------------
>>
>> /Users/oswald/gitwork-demokritos3d/demokritos3d/demokritos3d-dune- 
>> bleeding-edge/dune-common/dune/common/quadmath.hh: At global scope:
>> /Users/oswald/gitwork-demokritos3d/demokritos3d/demokritos3d-dune- 
>> bleeding-edge/dune-common/dune/common/quadmath.hh:318:21: error: 
>> expected initializer before '&' token
>>    318 |     inline Float128 fma(const Float128& t, const Float128& 
>> u, const Float128& v)
>> --------------
>>
>>
>> Now, I have another code which uses quadrature & compiles well & even 
>> links, which rather suggests this is my fault.
>>
>>
>> I use:
>>
>> Mac OS X, 15.7.1 (24G231)
>>
>> gcc 15.1
>>
>> and this gcc flag: -fext-numeric-literals
>>
>>
>> But still, if you have a suggestion, I am grateful,
>>
>> thanks & greetings, Benedikt
>>
>>
>>
>>
>>             LSPR AG
>>             Dr. sc. techn. Benedikt Oswald
>>             Founder, CTO
>>             
Kriesbachstrasse 3b
>>             CH 8304 Wallisellen
>>             
+41 43 366 90 74
>> benedikt.oswald at lspr.swiss
>> www.lspr.swiss <https://lspr.swiss>
>>
>>
>>
>>
>> _______________________________________________
>> Dune mailing list
>> Dune at lists.dune-project.org
>> https://lists.dune-project.org/mailman/listinfo/dune
>
-- 


            computational electrodynamics –
            dr. sc. techn. benedikt oswald
            Im Langstuck 29
            CH 8044 Gockhausen
            +41 76 380 91 33
            benedikt.oswald at aquante.ch
            <mailto: benedikt.oswald at aquante.ch>www.aquante.ch
            <https://aquante.ch>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20251209/6fa322f8/attachment-0001.htm>


More information about the Dune mailing list