Opened 4 years ago

Closed 10 months ago

#7660 closed bug (fixed)

warning: conflicting types when compiling via-C

Reported by: singpolyma Owned by: hvr
Priority: normal Milestone: 8.0.1
Component: Compiler Version: 7.7
Keywords: warning Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D1506
Wiki Page:

Description

I don't think this is actually a problem per-se, but usually these warnings are indicative of unsafe assumptions being made:

when making flags consistent: Warning:
    Compiler unregisterised, so compiling via C

/tmp/ghc7162_0/ghc7162_0.hc:1164:1:
     warning: conflicting types for built-in function 'memchr' [enabled by default]

/tmp/ghc7162_0/ghc7162_0.hc:6885:1:
     warning: conflicting types for built-in function 'memset' [enabled by default]

/tmp/ghc7162_0/ghc7162_0.hc:8594:1:
     warning: conflicting types for built-in function 'memcpy' [enabled by default]

/tmp/ghc7162_0/ghc7162_0.hc:11521:1:
     warning: conflicting types for built-in function 'free' [enabled by default]

/tmp/ghc7162_0/ghc7162_0.hc:11522:1:
     warning: conflicting types for built-in function 'realloc' [enabled by default]

/tmp/ghc7162_0/ghc7162_0.hc:12038:1:
     warning: conflicting types for built-in function 'malloc' [enabled by default]

/tmp/ghc7162_0/ghc7162_0.hc:13583:1:
     warning: conflicting types for built-in function 'strlen' [enabled by default]

/tmp/ghc7162_0/ghc7162_0.hc:13994:1:
     warning: conflicting types for built-in function 'memcmp' [enabled by default]

Change History (11)

comment:1 Changed 3 years ago by igloo

  • difficulty set to Unknown
  • Owner set to igloo

Thanks for the report; I'll take a look

comment:2 Changed 3 years ago by igloo

  • Milestone set to 7.8.1

comment:3 Changed 3 years ago by igloo

  • Owner igloo deleted

comment:4 Changed 2 years ago by thoughtpolice

  • Milestone changed from 7.8.3 to 7.10.1

Moving to 7.10.1

comment:5 Changed 22 months ago by thoughtpolice

  • Milestone changed from 7.10.1 to 7.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:6 Changed 13 months ago by thoughtpolice

  • Milestone changed from 7.12.1 to 8.0.1

Milestone renamed

comment:7 Changed 10 months ago by hvr

Here's a minimal C fragment extracted from such a .hc file which triggers this warning:

typedef void *(*(*StgFunPtr)(void))(void);

extern StgFunPtr strlen();

If the main purpose of this is to get a pointer to primitives such as strlen, then we can use -fno-builtin to fix this warning (works w/ clang & gcc).

comment:8 Changed 10 months ago by hvr

  • Owner set to hvr

comment:9 Changed 10 months ago by hvr

  • Differential Rev(s) set to Phab:D1506
  • Status changed from new to patch

comment:10 Changed 10 months ago by Ben Gamari <ben@…>

In 192dd068/ghc:

Suppress conflicting types for builtins warnings

GCC 4.0 and later warn about type-conflicting prototypes for built-in
functions such as `strlen`. This is a problem for the via-c backend as
it generates code such as

  typedef void *(*(*StgFunPtr)(void))(void);
  extern StgFunPtr strlen();

However, by using the `-fno-builtin` flag, GCC is told not to try to
auto-detect such built-in functions and instead treat them as ordinary
external functions.  This also suppresses this warning.

This address #7660

Test Plan: IIAM

Reviewers: bgamari, austin

Reviewed By: austin

Subscribers: thomie, erikd

Differential Revision: https://phabricator.haskell.org/D1506

GHC Trac Issues: #7660

comment:11 Changed 10 months ago by bgamari

  • Resolution set to fixed
  • Status changed from patch to closed

This should be resolved with the above commit.

Note: See TracTickets for help on using tickets.