First, it's not Mazda's fault you ran out of gas, it's yours. No gas gauge/warning light/range indicator is 100% accurate. My 2012 CX-9 manual states "The fuel gauge shows approximately [emphasis added] how much fuel is remaining in the tank when the ignition is switched on. We receommend keepting the tank over 1/4 full." I imagine the 2017 manual says pretty much the same thing.
Personally, I don't trust fuel gauges/range indicators that much. Every time I fill the car, I reset one of the trip meters, and know that driving around town, I should be able to drive around 300 miles before refilling, 400 on the highway. This Friday night, I had about a third of a tank when I started my commute home, my preferred gas station is across the street from my work, so figured I'd fill up on Monday morning. I ran more errands in the car over the weekend than I anticipated and as I got close to work on Monday the warning light came on. When I filled up at the gas station, it took 17.102 gallons in a 21 gallon tank. That is the second time I've had the light come on, having owned the car three years and driven it about 28,000 miles. Playing chicken with the gas gauge is like asking the fuel pump to burn out.
Fill the gas tank at 1/4 full as Mazda advises and quit calling your car a lemon.