Skip to content

Missing linker warning for redeclaration of symbol? #6207

@Sola85

Description

@Sola85

Board

ESP32 Dev Module

Device Description

plain module, no external hardware

Hardware Configuration

Version

v2.0.2

IDE Name

Arduino

Operating System

Windows 10

Flash frequency

80 MHz

PSRAM enabled

no

Upload speed

921600

Description

I expect the following code to output
0
0
0
but the printed output is
0
0
-1306523032

Upon changing the name of the array "times" to something else, the expected output is printed. Is suspect the name "times" is used is some system library in the ESP toolchain. However, in this case I would expect the compilation of the sketch to fail, with an error message like "Redeclaration of symbol 'times', first declared here ...".
Instead, the sketch compiles fine, without any errors or warnings being printed. (Compiler warnings are set to 'all', and verbose output is enabled during compile)

Sketch

#include "time.h"

tm times[2];

void setup() {

  Serial.begin(115200);
  
  for (int i = 0; i < 2; i++){
    times[i].tm_min = 0;
    Serial.println(times[i].tm_min);
  }
  
  Serial.println(times[0].tm_min);
}

void loop() {

}

Debug Message

-

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions