[LLVMbugs] [Bug 10338] New: __attribute__((noreturn)) not matching functions in clang++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 12 06:34:46 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10338

           Summary: __attribute__((noreturn)) not matching functions in
                    clang++
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: howarth at nitro.med.uc.edu
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The plotutils 2.6 package built with clang/clang++ against png 1.5 exposes a
bug in clang++. The same z_write.c source file is compiled first with clang as
c in libplot and then with clang++ as c++ in libplotter. The c compilation
compiles without error under clang but under clang++ the compilation fails
with...

/bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..
-I./../include -I/sw/include  -DLIBPLOT -DLIBPLOTTER  -I/sw/include  -O2 -MT
z_write.lo -MD -MP -MF .deps/z_write.Tpo -c -o z_write.lo z_write.cc
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I./../include -I/sw/include
-DLIBPLOT -DLIBPLOTTER -I/sw/include -O2 -MT z_write.lo -MD -MP -MF
.deps/z_write.Tpo -c z_write.cc  -fno-common -DPIC -o .libs/z_write.o
z_write.cc:167:15: error: no matching function for call to 'png_set_longjmp_fn'
  if (setjmp (png_jmpbuf (png_ptr)))
              ^~~~~~~~~~~~~~~~~~~~
In file included from z_write.cc:43:
/sw/include/png.h:988:9: note: instantiated from:
      (*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf)))
        ^~~~~~~~~~~~~~~~~~
/sw/include/png.h:985:1: note: candidate function not viable: no known
conversion from 'void (int *, int)' to 'png_longjmp_ptr' (aka 'void (*)(int *,
int) __attribute__((noreturn))') for 2nd
      argument
PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structp png_ptr,
^
/sw/include/pngconf.h:319:4: note: instantiated from:
   PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
   ^
/sw/include/pngconf.h:309:7: note: instantiated from:
      PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \
      ^
/sw/include/png.h:985:1: note: instantiated from:
PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structp png_ptr,
^
/sw/include/pngconf.h:319:4: note: instantiated from:
   PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
   ^
/sw/include/png.h:985:1: note: instantiated from:
PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structp png_ptr,
^
/sw/include/png.h:985:25: note: instantiated from:
PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structp png_ptr,
                        ^
1 error generated.


Steps to Reproduce:

The attached no return_bug.tar.bz2 compressed archive contains the preprocessed
sources for the two compilations of z_write.c as z_write.i from clang and
z_write.ii from clang++. The bug can be demonstrated with...

clang -c z_write.i -fno-common -o z_write.o

clang++ -c z_write.ii -fno-common -o z_write.o

Expected Results:

I expected the z_write.ii preprocessed source to compile without error as it
does with llvm-gcc-4.2...

[MacPro:~/noreturn_bug] howarth% g++ -c z_write.ii -fno-common -o z_write.o
[MacPro:~/noreturn_bug] howarth% 

Actual Results:

[MacPro:~/noreturn_bug] howarth% clang++ -c z_write.ii -fno-common -o z_write.o
In file included from z_write.cc:1:
z_write.cc:167:17: error: no matching function for call to 'png_set_longjmp_fn'
  if (setjmp ((*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf)))))
                ^~~~~~~~~~~~~~~~~~
/sw/include/png.h:985:19: note: candidate function not viable: no known
conversion from 'void (int *, int)' to 'png_longjmp_ptr' (aka 'void
      (*)(int *, int) __attribute__((noreturn))') for 2nd argument
extern jmp_buf* ( png_set_longjmp_fn) (png_structp png_ptr, png_longjmp_ptr
longjmp_fn, size_t jmp_buf_size);
                  ^
1 error generated.

Also filed as radr://9757022 .

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list