This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/33521] New: -m128bit-long-double and printf don't mix


[#include <stdlib.h> // EXIT_SUCCESS
#include <stdio.h> // printf

int main(int argc, char** argv) {
    long double ld = 1.0;
    printf("ld = %Lg, string = %s\n", ld, "foo");
    return (EXIT_SUCCESS);
}]

[g++ -m128bit-long-double -Wall main.cpp -o test && ./test]

With the wider long double, a corrupted value is printed at %s. If the ld
declaration is changed to [long double ld = 1.0, lda[10];], nothing is printed,
and if the declaration is changed to [long double ld = 1.0, lda[10000];],
"(null)" is printed (without the quotes). If the -m128bit-long-double flag is
omitted, or if the %Lg is omitted (and its corresponding argument), no problems
occur (although I have not tested all 12 combinations). If this shouldn't be
tried at all (printf is in a library that was compiled with normal-width long
doubles), it would be nice to at least have a warning about it, but there seems
to be more than that going on. I may have no further interest in this issue,
which was encountered during some experiments.


-- 
           Summary: -m128bit-long-double and printf don't mix
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Raf_Schietekat at ieee dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33521


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]