Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nimble compile error (IDFGH-11343) #12491

Closed
3 tasks done
AxelLin opened this issue Oct 31, 2023 · 10 comments
Closed
3 tasks done

nimble compile error (IDFGH-11343) #12491

AxelLin opened this issue Oct 31, 2023 · 10 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@AxelLin
Copy link
Contributor

AxelLin commented Oct 31, 2023

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.2-dev-3775-gb4268c874a

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

What is the expected behavior?

build success.

What is the actual behavior?

/home/axel/esp/esp-idf/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c: In function 'ble_gap_master_connect_reattempt':
/home/axel/esp/esp-idf/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:1036:40: error: storing the address of local variable 'conn' in 'ble_conn_reattempt[idx].cb_arg' [-Werror=dangling-pointer=]
1036 | ble_conn_reattempt[idx].cb_arg = &conn;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/home/axel/esp/esp-idf/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:992:30: note: 'conn' declared here
992 | struct ble_gap_conn_desc conn;
| ^~~~
/home/axel/esp/esp-idf/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:130:46: note: 'ble_conn_reattempt' declared here
130 | static struct ble_gap_connect_reattempt_ctxt ble_conn_reattempt[MYNEWT_VAL(BLE_MAX_CONNECTIONS)];
|

Steps to reproduce.

Just build with nimble for esp32c3.

Build or installation Logs.

No response

More Information.

No response

@AxelLin AxelLin added the Type: Bug bugs in IDF label Oct 31, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label Oct 31, 2023
@github-actions github-actions bot changed the title nimble compile error nimble compile error (IDFGH-11343) Oct 31, 2023
@rahult-github
Copy link
Collaborator

Hi @AxelLin ,

May i know which example you attempting to compile ? We tried both peripheral and central and don't see the issue. Also enabled / disabled the ENABLE_CONN_REATTEMPT flag, but don't see the issue.

The code being pointed is not modifed since a year. Is there any specific GCC version being used for this ?

@AxelLin
Copy link
Contributor Author

AxelLin commented Oct 31, 2023

@rahult-github
I compile with our application code, not example code.
However, the error message does make sense, I think this needs fix.
/home/axel/esp/esp-idf/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:1036:40: error: storing the address of local variable 'conn' in 'ble_conn_reattempt[idx].cb_arg' [-Werror=dangling-pointer=]
1036 | ble_conn_reattempt[idx].cb_arg = &conn;

@AxelLin
Copy link
Contributor Author

AxelLin commented Oct 31, 2023

BTW, I didn't hit this issue when I build with v5.1 branch.
And the ble_gap.c file is exactly the same in v5.1 branch and master.
Maybe this is toolchain issue?

@KaeLL
Copy link
Contributor

KaeLL commented Oct 31, 2023

Seems to be an upstream code issue. cb_arg does become a dangling reference after ble_gap_master_connect_reattempt exits.

@rahult-github
Copy link
Collaborator

Hi @AxelLin ,

Not able to hit the issue at my end yet. Will investigate on the toolchain input provided.

In meantime, can you check if attached patch helps ?
dangling_pointer_error.txt

@AxelLin
Copy link
Contributor Author

AxelLin commented Nov 1, 2023

Hi @rahult-github
It's strange that I no longer hit the compile error today (even without your path).
I'm closing the issue, sorry for the noise.

@AxelLin AxelLin closed this as completed Nov 1, 2023
@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new labels Nov 1, 2023
@AxelLin
Copy link
Contributor Author

AxelLin commented Nov 7, 2023

Hi @AxelLin ,

Not able to hit the issue at my end yet. Will investigate on the toolchain input provided.

In meantime, can you check if attached patch helps ? dangling_pointer_error.txt

Hi @rahult-github
I hit this compile error again, and confirm your patch fixed the compile issue.

@rahult-github
Copy link
Collaborator

Hi @AxelLin , noted . Will raise fix internally.

@AxelLin
Copy link
Contributor Author

AxelLin commented Nov 21, 2023

Hi @AxelLin , noted . Will raise fix internally.

I reopen this issue because I still cannot find this fix in esp-nimble.

@AxelLin AxelLin reopened this Nov 21, 2023
@rahult-github
Copy link
Collaborator

Hi @AxelLin , the change is done on master and backported to release/v5.2 and release/v5.1 internally. It should be visible soon on github, once the sync / mirror happens .

@AxelLin AxelLin closed this as completed Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

4 participants