getgrgid bug when compiling in 32-bit on Redhat 7?

  32-bit, c++, redhat

I’ve been looking at this bug for the past couple of days now and can’t seem to find anything about it online, I noticed that when I try to use getgrgid and compile the program with a 32-bit flag the function does not return any group. But it is still getting the group id correctly.
Consider the following program:

#include <unistd.h>
#include <sys/types.h>
#include <iostream>
#include <grp.h>
int main()
    struct group* result = getgrgid(getgid());
    std::cout << result->gr_name << std::endl;

When compiled with g++ test.cpp -m32 -o test, the process will crash with segmentation fault (core dumped) (due to a null pointer being returned) being the error message. However when compiled with g++ test.cpp -m64 -o test the correct output is shown when the program is run.

My questions are:

Why does it not work on 32-bit?

Is it some configuration issue?

Has anyone seen this before?

Is there a workaround besides parsing through ps calls?

Should I report this as a bug?

Source: Windows Questions C++