Issue 86825
Summary flang/runtime/io-error.cpp:60: bad call to va_end ?
Labels flang
Assignees
Reporter dcb314
    Static analyser cppcheck says:

trunk/flang/runtime/io-error.cpp:60:11: error: va_list 'ap' used before va_start() was called. [va_list_usedBeforeStarted]

Source code is

        if (msg && (flags_ & hasIoMsg)) {
#if !defined(RT_DEVICE_COMPILATION)
 char buffer[256];
          va_list ap;
          va_start(ap, msg);
          std::vsnprintf(buffer, sizeof buffer, msg, ap);
 va_end(ap);
#else
          const char *buffer = "not implemented yet: IOSTAT with varargs";
#endif
          ioMsg_ = SaveDefaultCharacter(
              buffer, Fortran::runtime::strlen(buffer) + 1, *this);
#if !defined(RT_DEVICE_COMPILATION)
          va_end(ap);
#endif
 }

It looks to me like the final call to va_end should be removed.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to