php / php/php-src

address argument to atomic operation must be a pointer to non-const _Atomic type

未关闭
#8,881 10 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Category: Engine Status: Needs Triage
主要语言
C
星标
40.4k
派生
8.1k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

Description

Hello! I'm the maintainer of php in MacPorts, and I noticed this build failure of php 8.2.0alpha2 and 8.2.0alpha1 on macOS 10.13 with Xcode 9.4.1 and its Apple clang 902.0.39.2:

Zend/zend_atomic.h:85:9: error: address argument to atomic operation must be a pointer to non-const _Atomic type ('const _Atomic(bool) *' invalid)
        return __c11_atomic_load(&obj->value, __ATOMIC_SEQ_CST);
               ^                 ~~~~~~~~~~~

Here is a full failed build log from macOS 10.13.

I also verified the problem on macOS 10.13 with Xcode 10.1 and its Apple clang 1000.11.45.5.

It also fails similarly on macOS 10.12, OS X 10.11, and OS X 10.10.

The build succeeds on macOS 10.14 with Xcode 10.3 and its Apple clang 1001.0.46.4 and on newer systems. Here is a full successful build log from macOS 10.14.

Curiously the build also succeeds on much older systems like OS X 10.9, OS X 10.8, and Mac OS X 10.7 with their older versions of Xcode and clang.

I see "c11" in the error message but I don't see -std=c11 being passed to the compiler. Thinking this might be a situation where certain older compilers would support whatever you're wanting to do if only you would ask the compiler to be in c11 mode, I tried adding -std=c11 on macOS 10.13 with Xcode 10.1 and its Apple clang 1000.11.45.5, and I also tried -std=gnu11, but neither of those changed the error.

php 8.1.7 and earlier don't have this problem.

PHP Version

8.2.0alpha2

Operating System

macOS 10.13.6

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Zend/zend_atomic.h 开始,在报告中列出的受影响的 macOS 和 Apple clang 版本上重现 PHP 8.2 的构建。比较报告中的各个编译器版本之间原子操作的行为;当 PHP 能够在受影响的系统上成功构建,且不会导致较新和较旧配置出现回归时,工作即完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
c, php
领域
build-system, operating-systems
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。