[CDRIVER-4237] Incompatible pointer type warnings in atomics Created: 07/Dec/21  Updated: 28/Oct/23  Resolved: 19/Jan/22

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.21.0

Type: Bug Priority: Unknown
Reporter: Kevin Albertson Assignee: Ezra Chung
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by PHPC-2013 RHEL 7.0 and 7.1 builds fail due to i... Closed
Related
is related to CDRIVER-4229 zSeries /atomic/integers aborts with ... Closed
is related to CDRIVER-4124 Clean Up Internal Atomic APIs Closed

 Description   

RHEL 7.0 with GCC 4.8.5 produces warnings for incompatible pointer types.

Example 1

/data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.c:28:4: warning: passing argument 1 of 'bson_atomic_int32_fetch_add' from incompatible pointer type [enabled by default]
    return n + bson_atomic_int32_fetch_add (p, n, bson_memory_order_seq_cst);
    ^
In file included from /data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.c:18:0:
/data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.h:175:28: note: expected 'volatile long int *' but argument is of type 'volatile int32_t *'
    static BSON_INLINE Type bson_atomic_##NamePart##_fetch_add (               \
                            ^
/data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.h:350:1: note: in expansion of macro 'DECL_ATOMIC_INTEGRAL'
 DECL_ATOMIC_INTEGRAL (int32, long, )
 ^

Example 2

In file included from /data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.c:18:0:
/data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.h:298:28: note: expected 'volatile char *' but argument is of type 'int8_t *'
    static BSON_INLINE Type bson_atomic_##NamePart##_compare_exchange_weak (   \
                            ^
/data/mci/0679d561d3a78b572969638933bfea70/mongoc/src/libbson/src/bson/bson-atomic.h:347:1: note: in expansion of macro 'DECL_ATOMIC_INTEGRAL'
 DECL_ATOMIC_INTEGRAL (int8, char, 8);
 ^

This impacts consumers building with -Werror.



 Comments   
Comment by Githook User [ 10/Feb/22 ]

Author:

{'name': 'Jeremy Mikola', 'email': 'jmikola@gmail.com', 'username': 'jmikola'}

Message: PHPC-2013: Upgrade libmongoc to 1.21.0

Pulls in changes from CDRIVER-4237

Also addresses min/maxWireVersion bumps for PHPC-1909 and PHPC-2034.
Branch: master
https://github.com/mongodb/mongo-php-driver/commit/03d8858bff6564f4bbab4a7fb7ceb2400ebdc421

Comment by Githook User [ 19/Jan/22 ]

Author:

{'name': 'Ezra Chung', 'email': '88335979+eramongodb@users.noreply.github.com', 'username': 'eramongodb'}

Message: CDRIVER-4237 - Address incompatible pointer warnings on GCC 4.8.5 (#927)

Comment by Jeremy Mikola [ 07/Dec/21 ]

Note: While disabling -Werror for RHEL 7.0 and 7.1 hosts (PHPC-2013), I noticed that attempting to use the driver after a successful build results in SIGBUS errors on rhel71-power8 hosts: build log

This didn't happen on the x64 RHEL 7.0 hosts, so it may be specific to power8. I'm not sure if it's related to our use of the macro for int32_t phongo_num_threads (a8a2210 for PHPC-1997) or one of the internal calls for libmongoc.

Edit: I just came across CDRIVER-4229 (another platform conflict with the new atomic APIs). I wonder if that's related.

Generated at Wed Feb 07 21:20:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.