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

            Bug ID: 120452
           Summary: error: ISO C forbids conversion of function pointer to
                    object pointer type
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ssofroni at cytanet dot com.cy
  Target Milestone: ---

I tried to compile the Complete Example from
https://github.com/edubart/minicoro/ with GCC (Debian 14.2.0-19) 14.2.0 and
(Debian 13.3.0-16) 13.3.0 and would fail with the following message: `error:
ISO C forbids conversion of function pointer to object pointer type`.

Here's the full output:

ccache gcc -Wall -Wextra -Werror -Wpedantic -Wconversion -std=c11 -flto=auto -g
-Og -fno-omit-frame-pointer   -DDEBUG  -I src -c src/demo.c -o obj/demo.o
In file included from src/demo.c:2:
src/minicoro.h: In function ‘_mco_makectx’:
src/minicoro.h:835:14: error: ISO C forbids conversion of function pointer to
object pointer type [-Werror=pedantic]
  835 |   ctx->rip = (void*)(_mco_wrap_main);
      |              ^
src/minicoro.h:837:14: error: ISO C forbids conversion of function pointer to
object pointer type [-Werror=pedantic]
  837 |   ctx->r12 = (void*)(_mco_main);
      |              ^
cc1: all warnings being treated as errors
make: *** [Makefile:40: obj/demo.o] Error 1


When I replaced both versions of GCC with clang, it compiled without any
problems:

ccache clang -Wall -Wextra -Werror -Wpedantic -Wconversion -std=c11 -flto=auto
-g -Og -fno-omit-frame-pointer   -DDEBUG  -I src -c src/demo.c -o obj/demo.o
ccache clang obj/demo.o -o bin/demo -fno-strict-aliasing -fuse-ld=mold
-flto=auto -fwrapv -lm  
make  -j4 --jobserver-auth=fifo:/tmp/GMfifo20284 got executed in debug mode...


Is it an expected behavior or a regression from previous versions?

Reply via email to