Skip to content

schannel: fix compiler warning -Wstrict-aliasing in ALPN code - #23163

Closed
vszakats wants to merge 6 commits into
curl:masterfrom
vszakats:schan-aliasing
Closed

vszakats wants to merge 6 commits into
curl:masterfrom
vszakats:schan-aliasing

Conversation

@vszakats

@vszakats vszakats commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Seen in 32-bit -DCMAKE_BUILD_TYPE=Release builds, with GCC 6.4.0.
Reproduced by switching the dl-mingw 6.4.0 job to Release (from Debug).

Fixing:

lib/vtls/schannel.c: In function 'schannel_connect_step1':
lib/vtls/schannel.c:938:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     *(unsigned int *)(void *)&alpn_buffer[cur] =
     ^

Ref: https://github.com/curl/curl/actions/runs/36553564862/job/109357301399?pr=23161#step:11:177

Cherry-picked from #23161


Reproduced by switching the dl-mingw 6.4.0 job to Release (from Debug).
Confirmed this patch fixes the warning while keeping rest of CI green:
https://github.com/curl/curl/actions/runs/36555911927/job/109372993433

```
lib/vtls/schannel.c: In function 'schannel_connect_step1':
lib/vtls/schannel.c:938:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     *(unsigned int *)(void *)&alpn_buffer[cur] =
     ^
```
Ref: https://github.com/curl/curl/actions/runs/36553564862/job/109357301399?pr=23161#step:11:177

Cherry-picked from curl#23161
@github-actions github-actions Bot added Windows Windows-specific CI Continuous Integration labels Sep 29, 2026
@vszakats
vszakats marked this pull request as draft September 29, 2026 10:26
@vszakats vszakats changed the title [TESTS] GHA/windows: 32-bit tests schannel: fix compiler warning -Wstrict-aliasing Sep 29, 2026
@vszakats vszakats changed the title schannel: fix compiler warning -Wstrict-aliasing schannel: fix compiler warning -Wstrict-aliasing in ALPN code Sep 29, 2026
@vszakats
vszakats marked this pull request as ready for review September 29, 2026 10:31

This comment was marked as outdated.

@github-actions github-actions Bot added the TLS label Sep 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified.

Review effort: Lite
Findings: None

Resolved since last review (1)

@vszakats vszakats closed this in ea21cab Sep 29, 2026
@vszakats
vszakats deleted the schan-aliasing branch September 29, 2026 11:28
vszakats added a commit that referenced this pull request Sep 29, 2026
As the `mingw32` environment is deprecated in MSYS2. Reduce it to a
single, standalone job, still using a couple of `mingw32` packages, till
we can.

Changes: drop building: debug, unicode, unity in 32-bit mingw-w64.
Dropping 1 job taking ~2.5 minutes, adding ~half minute to remaining
one. Saving 2 minutes overall.

It also simplifies things by avoiding errors due to packages missing
from `mingw32`, but available in first tier envs. E.g. when adding
`libssh` or `wolfssl` to the per-workflow `install:` list. I expect this
list to gradually grow.

Note, `mingw32` packages are still used in the remaining 32-bit job.

Fixing one instance of:
```
Warning: [msystem-mingw32] MINGW32 is deprecated because 32-bit
environments are being phased out. There is no direct replacement. To
acknowledge and suppress this warning, add 'msystem-mingw32' to
'suppress-deprecation-warnings'.
```
Ref: https://github.com/curl/curl/actions/runs/36551828804/job/109351622601?pr=23155#step:4:27

Follow-up to ea21cab #23163
Follow-up to 14037d1 #23154

Closes #23161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration HTTP/2 TLS Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

2 participants