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/81448] False positive -Werror=multistatement-macros in openssl


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81448

--- Comment #6 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Marek Polacek from comment #5)
> PR81364 is fixed, do you still see any false positives?

Well adding braces would fix the warning,
but consider this slightly reduced test case:

void b_ecb_encrypt();

#define BLOCK_CIPHER_ecb_loop() \
        int i, bl; \
        bl = 100; \
        if (inl < bl) return 1; \
        inl -= bl; \
        for (i=0; i <= inl; i+=bl)

#define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
int cname##_ecb_cipher(char *out, char *in, int inl) \
{ \
  BLOCK_CIPHER_ecb_loop() \
    cprefix##_ecb_encrypt(in + i, out + i); \
  return 1; \
}

BLOCK_CIPHER_func_ecb(a,b,c,d)

int test(unsigned char *out, const unsigned char *in, int inl)
{
  BLOCK_CIPHER_ecb_loop()
    b_ecb_encrypt(in + i, out + i);
  return 1;
}


Why is the warning only in the macro expansion
and not in explicit instantiation ?

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